Skip to content

Commit

Permalink
Fix speed in web
Browse files Browse the repository at this point in the history
  • Loading branch information
vypxl committed Jan 30, 2022
1 parent 233b3cb commit 3d43a5f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ Sort::~Sort() { }

#ifdef __EMSCRIPTEN__
void Sort::em_tick() {
if (!finished && !paused)
stats.elapsed = std::chrono::system_clock::now() - starttime;
auto tick_begin = std::chrono::system_clock::now();

if (!paused) step();
while (std::chrono::system_clock::now() - tick_begin < std::chrono::milliseconds(15)) {
if (!finished && !paused)
stats.elapsed = std::chrono::system_clock::now() - starttime;

if (!paused) step();
}
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/viz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ int Viz::init() {
// Initialize VBOs
glGenBuffers(1, &dataBuffer);
glGenBuffers(1, &indexBuffer);

// Initialize data, sort and style
setDataSize(dataSizes[current_data_size]);
changeStyle(Styles::Varietyloop);
Expand Down

0 comments on commit 3d43a5f

Please sign in to comment.