Skip to content

Commit

Permalink
Performance investigation (#30)
Browse files Browse the repository at this point in the history
**User-Facing Changes**
Performance improvements

**Description**
This PR intends to increase the performance of the application, by
applying those changes:

- Increase cacheSize when reading remote and local files in order to
take more advantage of the caching itself, instead of refreshing the
application more often
- Increasing the logging interval in order to avoid high loads when
saving the logs


**Checklist**

- [x] The web version was tested and it is running ok
- [x] The desktop version was tested and it is running ok
- [x] The release version was updated on package.json files

---------

Co-authored-by: Lais Portugal <[email protected]>
  • Loading branch information
laisspportugal and laisspportugal authored May 29, 2024
1 parent 7a4e869 commit 732c5a3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "foxbox",
"version": "1.0.3",
"version": "1.0.4",
"license": "MPL-2.0",
"private": true,
"productName": "Foxbox",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { MessageReader } from "@foxglove/rosmsg-serialization";
import { compare } from "@foxglove/rostime";
import { estimateObjectSize } from "@foxglove/studio-base/players/messageMemoryEstimation";
import {
PlayerProblem,
MessageEvent,
PlayerProblem,
Topic,
TopicStats,
} from "@foxglove/studio-base/players/types";
Expand All @@ -22,11 +22,11 @@ import Bzip2 from "@foxglove/wasm-bz2";
import decompressLZ4 from "@foxglove/wasm-lz4";

import {
GetBackfillMessagesArgs,
IIterableSource,
IteratorResult,
Initalization,
IteratorResult,
MessageIteratorArgs,
GetBackfillMessagesArgs,
} from "./IIterableSource";

type BagSource = { type: "file"; file: File } | { type: "remote"; url: string };
Expand All @@ -53,7 +53,7 @@ export class BagIterableSource implements IIterableSource {
const fileReader = new BrowserHttpReader(bagUrl);
const remoteReader = new CachedFilelike({
fileReader,
cacheSizeInBytes: 1024 * 1024 * 200, // 200MiB
cacheSizeInBytes: 1024 * 1024 * 500, // 500MiB
keepReconnectingCallback: (_reconnecting) => {
// no-op?
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class RemoteFileReadable {
const fileReader = new BrowserHttpReader(url);
this.#remoteReader = new CachedFilelike({
fileReader,
cacheSizeInBytes: 1024 * 1024 * 200, // 200MiB
cacheSizeInBytes: 1024 * 1024 * 500, // 500MiB
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/studio-base/src/util/CachedFilelike.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export interface FileReader {
fetch(offset: number, length: number): FileStream;
}

const LOGGING_INTERVAL_IN_BYTES = 1024 * 1024 * 100; // Log every 100MiB to avoid cluttering the logs too much.
const LOGGING_INTERVAL_IN_BYTES = 1024 * 1024 * 300; // Log every 300MiB to avoid cluttering the logs too much.
const CACHE_BLOCK_SIZE = 1024 * 1024 * 10; // 10MiB blocks.
// Don't start a new connection if we're 5MiB away from downloading the requested byte.
const CLOSE_ENOUGH_BYTES_TO_NOT_START_NEW_CONNECTION = 1024 * 1024 * 5;
Expand Down
2 changes: 1 addition & 1 deletion packages/studio/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@foxglove/studio",
"version": "1.0.3",
"version": "1.0.4",
"license": "MPL-2.0",
"repository": {
"type": "git",
Expand Down

0 comments on commit 732c5a3

Please sign in to comment.