Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply all the recent performance improvements #381

Merged
merged 2 commits into from
Jun 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion livesplit-core
Submodule livesplit-core updated 81 files
+7 −5 Cargo.toml
+70 −0 benches/layout_state.rs
+4 −4 capi/bind_gen/src/typescript.ts
+4 −9 capi/src/blank_space_component.rs
+2 −2 capi/src/current_pace_component.rs
+4 −2 capi/src/delta_component.rs
+4 −2 capi/src/detailed_timer_component.rs
+4 −2 capi/src/graph_component.rs
+0 −1 capi/src/hotkey_config.rs
+23 −3 capi/src/layout.rs
+1 −1 capi/src/layout_editor.rs
+17 −0 capi/src/layout_state.rs
+6 −1 capi/src/lib.rs
+2 −2 capi/src/pb_chance_component.rs
+2 −2 capi/src/possible_time_save_component.rs
+4 −2 capi/src/previous_segment_component.rs
+8 −2 capi/src/run.rs
+2 −4 capi/src/separator_component.rs
+4 −2 capi/src/splits_component.rs
+1 −1 capi/src/timer.rs
+4 −2 capi/src/timer_component.rs
+2 −2 capi/src/title_component_state.rs
+2 −2 crates/livesplit-hotkey/src/linux/mod.rs
+46 −37 crates/livesplit-hotkey/src/wasm_web/mod.rs
+2 −2 src/analysis/current_pace.rs
+2 −2 src/analysis/delta.rs
+2 −0 src/analysis/mod.rs
+7 −16 src/analysis/pb_chance/mod.rs
+1 −1 src/analysis/pb_chance/tests.rs
+3 −3 src/analysis/possible_time_save.rs
+223 −0 src/analysis/skill_curve.rs
+4 −4 src/analysis/state_helper.rs
+212 −0 src/clear_vec.rs
+10 −8 src/comparison/balanced_pb.rs
+21 −160 src/comparison/goal.rs
+16 −9 src/comparison/mod.rs
+9 −4 src/component/blank_space.rs
+22 −10 src/component/current_comparison.rs
+54 −31 src/component/current_pace.rs
+43 −21 src/component/delta/mod.rs
+5 −5 src/component/delta/tests.rs
+67 −37 src/component/detailed_timer/mod.rs
+31 −21 src/component/detailed_timer/tests.rs
+258 −243 src/component/graph.rs
+5 −4 src/component/key_value.rs
+24 −13 src/component/pb_chance.rs
+42 −30 src/component/possible_time_save.rs
+51 −33 src/component/previous_segment.rs
+57 −40 src/component/segment_time/mod.rs
+6 −4 src/component/separator.rs
+32 −22 src/component/splits/column.rs
+98 −68 src/component/splits/mod.rs
+27 −27 src/component/splits/tests/column.rs
+6 −6 src/component/splits/tests/mod.rs
+30 −15 src/component/sum_of_best.rs
+65 −26 src/component/text/mod.rs
+44 −20 src/component/timer.rs
+130 −71 src/component/title/mod.rs
+27 −16 src/component/total_playtime.rs
+74 −4 src/layout/component.rs
+2 −2 src/layout/editor/mod.rs
+6 −0 src/layout/layout_direction.rs
+1 −1 src/layout/layout_state.rs
+28 −15 src/layout/mod.rs
+1 −0 src/lib.rs
+8 −5 src/platform/wasm/web/time.rs
+2 −2 src/rendering/component/title.rs
+1 −1 src/rendering/glyph_cache.rs
+10 −11 src/rendering/mod.rs
+8 −12 src/rendering/software.rs
+83 −0 src/run/comparisons.rs
+1 −1 src/run/editor/mod.rs
+112 −85 src/run/mod.rs
+1 −2 src/run/saver/livesplit.rs
+7 −15 src/run/segment.rs
+1 −1 src/settings/color.rs
+13 −1 src/settings/gradient.rs
+1 −1 src/settings/image/shrinking.rs
+1 −1 src/timing/mod.rs
+36 −4 src/timing/timer/mod.rs
+26 −12 tests/rendering.rs
4 changes: 2 additions & 2 deletions src/layout/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class Title extends React.Component<Props> {
const finishedRunsExist = this.props.state.finished_runs !== null;
const attemptsExist = this.props.state.attempts !== null;
const line2 = this.props.state.line2;
const twoLines = line2 !== null;
const twoLines = line2.length !== 0;
const showIcon = iconUrl !== "";
const showAttempts = attemptsExist || finishedRunsExist;

Expand Down Expand Up @@ -72,7 +72,7 @@ export default class Title extends React.Component<Props> {
}
<div className={`title-category ${alignmentClass}`}>
<Abbreviated abbreviations={
line2 !== null ? line2 : this.props.state.line1
twoLines ? line2 : this.props.state.line1
} />
</div>
{
Expand Down
4 changes: 3 additions & 1 deletion src/ui/LayoutView.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import * as React from "react";
import { SharedTimer, Layout } from "../livesplit-core";
import { SharedTimer, Layout, LayoutStateRefMut } from "../livesplit-core";
import { TimerView } from "./TimerView";

export interface Props {
isDesktop: boolean,
layout: Layout,
layoutState: LayoutStateRefMut,
layoutWidth: number,
renderWithSidebar: boolean,
sidebarOpen: boolean,
Expand Down Expand Up @@ -33,6 +34,7 @@ export class LayoutView extends React.Component<Props> {
public render() {
const renderedView = <TimerView
layout={this.props.layout}
layoutState={this.props.layoutState}
layoutWidth={this.props.layoutWidth}
isDesktop={this.props.isDesktop}
renderWithSidebar={false}
Expand Down
7 changes: 6 additions & 1 deletion src/ui/LiveSplit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Sidebar from "react-sidebar";
import {
HotkeySystem, Layout, LayoutEditor, Run, RunEditor,
Segment, SharedTimer, Timer, TimerRef, TimerRefMut,
HotkeyConfig,
HotkeyConfig, LayoutState,
} from "../livesplit-core";
import { convertFileToArrayBuffer, convertFileToString, exportFile, openFileAsString } from "../util/FileUtil";
import { Option, assertNull, expect, maybeDisposeAndThen, panic } from "../util/OptionUtil";
Expand Down Expand Up @@ -53,6 +53,7 @@ export interface State {
isBrowserSource: boolean,
isDesktop: boolean,
layout: Layout,
layoutState: LayoutState,
layoutWidth: number,
menu: Menu,
openedSplitsKey?: number,
Expand Down Expand Up @@ -147,6 +148,7 @@ export class LiveSplit extends React.Component<Props, State> {
isDesktop: isDesktop && !isBrowserSource,
isBrowserSource,
layout,
layoutState: LayoutState.new(),
layoutWidth: props.layoutWidth,
menu: { kind: MenuKind.Timer },
sidebarOpen: false,
Expand Down Expand Up @@ -207,6 +209,7 @@ export class LiveSplit extends React.Component<Props, State> {
);
this.state.timer.dispose();
this.state.layout.dispose();
this.state.layoutState.dispose();
this.state.hotkeySystem?.dispose();
this.isDesktopQuery.removeListener(this.mediaQueryChanged);
}
Expand Down Expand Up @@ -240,6 +243,7 @@ export class LiveSplit extends React.Component<Props, State> {
} else if (this.state.menu.kind === MenuKind.Timer) {
return <TimerView
layout={this.state.layout}
layoutState={this.state.layoutState}
layoutWidth={this.state.layoutWidth}
isDesktop={this.state.isDesktop}
renderWithSidebar={true}
Expand All @@ -250,6 +254,7 @@ export class LiveSplit extends React.Component<Props, State> {
} else if (this.state.menu.kind === MenuKind.Layout) {
return <LayoutView
layout={this.state.layout}
layoutState={this.state.layoutState}
layoutWidth={this.state.layoutWidth}
isDesktop={this.state.isDesktop}
renderWithSidebar={true}
Expand Down
5 changes: 3 additions & 2 deletions src/ui/TimerView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react";
import { toast } from "react-toastify";
import {
SharedTimer, TimerRef, TimerRefMut, Layout,
TimingMethod, TimeSpan,
TimingMethod, TimeSpan, LayoutStateRefMut,
} from "../livesplit-core";
import { Option } from "../util/OptionUtil";
import DragUpload from "./DragUpload";
Expand All @@ -16,6 +16,7 @@ import "../css/TimerView.scss";
export interface Props {
isDesktop: boolean,
layout: Layout,
layoutState: LayoutStateRefMut,
layoutWidth: number,
renderWithSidebar: boolean,
sidebarOpen: boolean,
Expand Down Expand Up @@ -75,7 +76,7 @@ export class TimerView extends React.Component<Props, State> {
>
<AutoRefreshLayout
getState={() => this.readWith(
(t) => this.props.layout.stateAsJson(t),
(t) => this.props.layout.updateStateAsJson(this.props.layoutState, t),
)}
allowResize={this.props.isDesktop}
width={this.props.layoutWidth}
Expand Down