Skip to content

Commit

Permalink
Optimization of memory usage in replace.c
Browse files Browse the repository at this point in the history
* Add two fast paths that completely avoid the replacement machinery
  (these two fast paths were formerly present in 3.1);
* Use a circular buffer instead of a list for the temporary queue of
  tokens in streams;
* Do not reallocate tokens passed from the copy-replacing stream to the
  replace stream
  • Loading branch information
lefessan committed Apr 27, 2024
1 parent 7b69950 commit 82100d6
Show file tree
Hide file tree
Showing 4 changed files with 372 additions and 197 deletions.
11 changes: 7 additions & 4 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ NEWS - user visible changes -*- outline -*-
* More notable changes

** execution times were significantly reduced for the following:
comparison between a numeric DISPLAY variable to another or to a literal
comparison between numeric DISPLAY or BCD variable to zero
INSPECT CONVERTING (and "simple" INSPECT REPLACING), in general
and especially if both from and to are constants
comparison between a numeric DISPLAY variable to another or to a
literal comparison between numeric DISPLAY or BCD variable to zero
INSPECT CONVERTING (and "simple" INSPECT REPLACING), in general and
especially if both from and to are constants

** optimization of the two-pass preprocessing step of cobc: memory usage
and performance should be back close to the ones of 3.1.

* Changes in the COBOL runtime

Expand Down
10 changes: 10 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@

2024-04-24 Fabrice Le Fessant <[email protected]>

* replace.c: optimize speed and memory usage. For speed, we add two
fast paths in cb_ppecho_copy_replace() to completely skip the
replacement machinery if there is no need for it. For allocations,
we only allocate tokens that are coming from the lexer (not the
ones passed internally from the copy-replacing stream to the
replace stream) and we use a circular buffer for the temporary
queue of tokens instead of a list.

2024-03-17 Fabrice Le Fessant <[email protected]>
Emilien Lemaire <[email protected]>

Expand Down
Loading

0 comments on commit 82100d6

Please sign in to comment.