Skip to content

Commit

Permalink
feat: remove performance measurement
Browse files Browse the repository at this point in the history
  • Loading branch information
tlaundal committed Aug 26, 2022
1 parent 04cc597 commit fed7b95
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 64 deletions.
43 changes: 0 additions & 43 deletions src/internal/performance/performanceMeasurements.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/operators/reduceState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const reduceState = <State>(
pipe(
combineReducers(defaultState, reducers, {
errorSubject,
performanceMarker: name,
}),
startWith(defaultState),
shareReplay({
Expand Down
22 changes: 2 additions & 20 deletions src/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
from,
pipe,
} from 'rxjs';
import { filter, map, mergeWith, scan, tap } from 'rxjs/operators';
import { filter, map, mergeWith, scan } from 'rxjs/operators';
import {
UnknownAction,
UnknownActionCreator,
Expand All @@ -16,10 +16,6 @@ import {
} from './internal/types';
import { defaultErrorSubject } from './internal/defaultErrorSubject';
import { ofType } from './operators/operators';
import {
endPerformanceMeasurement,
startPerformanceMeasurement,
} from './internal/performance/performanceMeasurements';
import { isObservableInput } from './isObservableInput';

const wrapInArray = <T>(val: T | T[]): T[] =>
Expand Down Expand Up @@ -193,7 +189,6 @@ const ACTION_ORIGIN = Symbol('Action origin');

type CombineReducersConfig = {
errorSubject?: Subject<any>;
performanceMarker?: string;
namespace?: string;
};

Expand All @@ -218,9 +213,6 @@ type CombineReducersConfig = {
* `defaultErrorSubject`, which will rethrow the errors globally, as uncaught
* exceptions. The stream will not complete or emit any value upon an error.
*
* If a performanceMarker is passed, combineReducers will add performance marks
* using the window.performance API
*
* @param seed The initial input to the first reducer call
* @param reducers The reducer entries that should be combined
* @param namespace Namespace to pass on to the reducers. Note that this will
Expand All @@ -230,11 +222,7 @@ type CombineReducersConfig = {
export const combineReducers = <State>(
seed: State,
reducers: RegisteredReducer<State, any>[],
{
errorSubject = defaultErrorSubject,
performanceMarker,
namespace,
}: CombineReducersConfig = {}
{ errorSubject = defaultErrorSubject, namespace }: CombineReducersConfig = {}
): OperatorFunction<UnknownAction, State> => {
const actionReducers = reducers.filter(isActionReducer);
const streamReducers = reducers.filter(isStreamReducer);
Expand All @@ -261,9 +249,6 @@ export const combineReducers = <State>(
ofType(...actionReducers.flatMap((reducerFn) => reducerFn.trigger.actions)),
map((action): Packet => ({ origin: ACTION_ORIGIN, value: action })),
mergeWith(...source$s),
tap(() => {
if (performanceMarker) startPerformanceMeasurement(performanceMarker);
}),
scan(
({ state }, packet) => {
try {
Expand All @@ -290,9 +275,6 @@ export const combineReducers = <State>(
},
{ state: seed, caughtError: false }
),
tap(() => {
if (performanceMarker) endPerformanceMeasurement(performanceMarker);
}),
filter(({ caughtError }) => caughtError === false),
map(({ state }) => state)
);
Expand Down

0 comments on commit fed7b95

Please sign in to comment.