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 17, 2022
1 parent 283d35a commit 1dd4fcf
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
@@ -1,5 +1,5 @@
import { Observable, OperatorFunction, Subject, pipe } from 'rxjs';
import { filter, map, merge, scan, tap } from 'rxjs/operators';
import { filter, map, merge, scan } from 'rxjs/operators';
import {
UnknownAction,
UnknownActionCreator,
Expand All @@ -8,10 +8,6 @@ import {
} from './internal/types';
import { defaultErrorSubject } from './internal/defaultErrorSubject';
import { ofType } from './operators/operators';
import {
endPerformanceMeasurement,
startPerformanceMeasurement,
} from './internal/performance/performanceMeasurements';

const wrapInArray = <T>(val: T | T[]): T[] =>
Array.isArray(val) ? val : [val];
Expand Down Expand Up @@ -182,7 +178,6 @@ const ACTION_ORIGIN = Symbol('Action origin');

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

Expand All @@ -207,9 +202,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 @@ -219,11 +211,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 @@ -250,9 +238,6 @@ export const combineReducers = <State>(
ofType(...actionReducers.flatMap((reducerFn) => reducerFn.trigger.actions)),
map((action): Packet => ({ origin: ACTION_ORIGIN, value: action })),
merge(...source$s),
tap(() => {
if (performanceMarker) startPerformanceMeasurement(performanceMarker);
}),
scan(
({ state }, packet) => {
try {
Expand All @@ -279,9 +264,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 1dd4fcf

Please sign in to comment.