@@ -13,7 +13,8 @@ const engine = new Liquid(engineOptions)
13
13
const SAMPLE_COUNT = 1024
14
14
15
15
function memory ( ) {
16
- console . log ( '--- memory ---' )
16
+ console . log ( ' memory' )
17
+ console . log ( '------------------------' )
17
18
html ( )
18
19
todolist ( )
19
20
}
@@ -29,11 +30,11 @@ function html () {
29
30
templates . push ( engine . parse ( str ) )
30
31
}
31
32
const diff1 = ( getHeapStatistics ( ) . used_heap_size - base ) / SAMPLE_COUNT
32
- console . log ( `${ h ( str . length ) } lorem-html before GC x ${ h ( diff1 ) } /tpl (${ SAMPLE_COUNT } instances sampled)` )
33
+ console . log ( `[lorem-html ${ h ( str . length ) } ][ before GC] ${ h ( diff1 ) } /tpl (${ SAMPLE_COUNT } runs sampled)` )
33
34
34
35
global . gc ( )
35
36
const diff2 = ( getHeapStatistics ( ) . used_heap_size - base ) / SAMPLE_COUNT
36
- console . log ( `${ h ( str . length ) } lorem-html after GC x ${ h ( diff2 ) } /tpl (${ SAMPLE_COUNT } instances sampled)` )
37
+ console . log ( `[lorem-html ${ h ( str . length ) } ][ after GC] ${ h ( diff2 ) } /tpl (${ SAMPLE_COUNT } runs sampled)` )
37
38
}
38
39
39
40
function todolist ( ) {
@@ -47,15 +48,15 @@ function todolist () {
47
48
templates . push ( engine . parse ( str ) )
48
49
}
49
50
const diff1 = ( getHeapStatistics ( ) . used_heap_size - base ) / SAMPLE_COUNT
50
- console . log ( `${ h ( str . length ) } todolist before GC x ${ h ( diff1 ) } /tpl (${ SAMPLE_COUNT } instances sampled)` )
51
+ console . log ( `[todolist ${ h ( str . length ) } ][ before GC] ${ h ( diff1 ) } /tpl (${ SAMPLE_COUNT } runs sampled)` )
51
52
52
53
global . gc ( )
53
54
const diff2 = ( getHeapStatistics ( ) . used_heap_size - base ) / SAMPLE_COUNT
54
- console . log ( `${ h ( str . length ) } todolist after GC x ${ h ( diff2 ) } /tpl (${ SAMPLE_COUNT } instances sampled)` )
55
+ console . log ( `[todolist ${ h ( str . length ) } ][ after GC] ${ h ( diff2 ) } /tpl (${ SAMPLE_COUNT } runs sampled)` )
55
56
}
56
57
57
58
function h ( size ) {
58
- return ( size / 1024 ) . toFixed ( 3 ) + ' kB '
59
+ return ( size / 1024 ) . toFixed ( 3 ) + ' KB '
59
60
}
60
61
61
62
module . exports = { memory }
0 commit comments