ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Check also http://www.picolisp.com for more information
patrixl has quit [Quit: Leaving.]
patrixl has joined #picolisp
patrixl has joined #picolisp
orivej has joined #picolisp
twelvemonkeys has quit [Ping timeout: 256 seconds]
twelvemonkeys has joined #picolisp
razzy has joined #picolisp
patrixl has quit [Quit: Leaving.]
twelvemonkeys has quit [Ping timeout: 260 seconds]
twelvemonkeys has joined #picolisp
patrixl has joined #picolisp
_whitelogger has joined #picolisp
mtsd has joined #picolisp
mtsd has quit [Quit: Leaving]
razzy has quit [Quit: Connection closed]
<aw-> hi all
<beneroth> hi aw-
<aw-> i'm wondering about picolisp memory usage
razzy has joined #picolisp
<aw-> if I do: (need (** 2 22) 0) then it's not very fast, and (heap) increases quite significantly
<aw-> (gc) doesn't do anything
<aw-> am I missing something?
<tankf33der> yeap
<tankf33der> let me try
<tankf33der> http://ix.io/2oSo
<tankf33der> try run this code with and without (gc 70)
<tankf33der> and check benchmarking times.
<tankf33der> creating 4M list is ok if heap is big enough
<aw-> ohhhh
<aw-> so increase heap size _before_ running (need)
<aw-> wow that's brilliant
<aw-> super fast now
<aw-> thanks tankf33der
<aw-> how can I know what size to increase to?
<tankf33der> (println (heap))
<tankf33der> in the code already.
<aw-> no sorry
<aw-> i mean, before running (need)
<tankf33der> comment (gc 70)
<aw-> i need to see how (heap) is allocated
<tankf33der> (println (heap))
<aw-> sorry i'm not being clear
<aw-> (** 2 22) is 4194304
<tankf33der> ok
<aw-> with (need (** 2 22) 0) # how do i know how many bytes this will require?
<tankf33der> ok again.
<tankf33der> http://ix.io/2oSp
<tankf33der> this code prints - how many bytes this will require
<tankf33der> next:
<aw-> ex: [de myneed (Num Size) (gc Size) (need (** 2 Num)) ]
<tankf33der> i set (gc 70) -> create heap size 70MB, so creating 4M list will not call gc every time.
<aw-> why 70?
<aw-> how did you find that number?
<tankf33der> http://ix.io/2oSp
<tankf33der> this code prints 66
<tankf33der> right?
<aw-> whatt if I said (need (** 2 16)) ?
<aw-> i can't test for every value
<aw-> ok maybe i can make my own formula
<aw-> (/ 4194304 66)
<aw-> -> 63550
<tankf33der> heap size and size of list is different things.
<aw-> yes but heap size increases based on list size, right?
<tankf33der> heap increases when no enough space for new cells.
<tankf33der> (gc 70) is set heap = 70MB
<aw-> yes i understand that
<aw-> i think you don't understand my question
<tankf33der> :)
<aw-> look at this: [de myneed (Num Size) (gc Size) (need (** 2 Num)) ]
<aw-> how do I know what Size to use when calling (myneed)
<aw-> (myneed 22 70) - ok that works fine,
<aw-> what about (myneed 20 ?) or (myneed 24 ?)
<tankf33der> gc is global function, move out from function first.
<aw-> it's just an example
mtsd has joined #picolisp
<tankf33der> and set gc maximum you need after experiments.
<aw-> :\
<tankf33der> otherwise you will get performance degradation.
<tankf33der> creating 4M lists is suspicious.
<aw-> why?
<aw-> i read in the PicoLisp docs:
<aw-> "There are no limits imposed upon the language due to limitations of the virtual machine architecture. That is, there is no upper bound in symbol name length, number digit counts, stack depth, or data structure and buffer sizes, except for the total memory size of the host machine."
<tankf33der> of course.
<aw-> so, not suspicious
<tankf33der> in practice you may need something different. what you gonna do? read in 6MB file ?
<aw-> not sure why picolisp needs 70MB of memory to hold a list of 4M zeros...
<aw-> that's more suspicious
<tankf33der> one zero is cell, not byte
<aw-> yeah... maybe i'm doing it wrong
<Regenaxer> aw-, just multiply the list length with the cell size
<Regenaxer> and perhaps add some safety margin
<aw-> hmmm
<aw-> Regenaxer hi
<aw-> what is the cell size? 1MB?
<aw-> no that makes no sense
<Regenaxer> 16 bytes on 64 bit
<aw-> ahhh
<aw-> there we go
<Regenaxer> :)
<Regenaxer> then divide by 1 M to get the gc arg
<aw-> (/ (* (** 2 22) 16) 1024 1024)
<aw-> perfect
<Regenaxer> yes
<aw-> thank you!
<Regenaxer> if you know the max size in advance
<aw-> + some safety margin
<Regenaxer> yeah
<Regenaxer> Is this a script?
<Regenaxer> Because in a longer running program it is not so critical, takes time only the first time
<aw-> yes
<aw-> yes i noticed that
<aw-> if it's the same values
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
<tankf33der> (equ HEAP (* 1024 1024)) # Heap size in bytes
<tankf33der> (equ CELLS (/ HEAP 16)) # Number of cells in a single heap (65536)
<tankf33der> picolisp/src64/defs.l
<Regenaxer> right
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp
<aw-> hmmm
<aw-> is (insert) and (place) the exact same thing?
<aw-> the docs i have make them seem identical
<Regenaxer> no, insert should make the list longer
<aw-> oh
<aw-> docs have identical description
<Regenaxer> oh
<Regenaxer> No, is says "Insert" or "Place" :)
<Regenaxer> "Inserts" or "Places"
<Regenaxer> Isn't this a difference in English?
orivej has quit [Quit: No Ping reply in 180 seconds.]
orivej has joined #picolisp
<aw-> hmmmm you're right
<Regenaxer> Pfff, now did a big rewrite of pil21
<aw-> sorry
<Regenaxer> no problem :)
<Regenaxer> I hope I did not break too much
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 260 seconds]
orivej_ has joined #picolisp
mtsd has quit [Quit: Leaving]
rob_w has joined #picolisp
rob_w has quit [Changing host]
rob_w has joined #picolisp
orivej_ has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
f8l has quit [Remote host closed the connection]
f8l has joined #picolisp
orivej has quit [Ping timeout: 264 seconds]
orivej has joined #picolisp
razzy has quit [Quit: Connection closed]
orivej_ has joined #picolisp
orivej has quit [Ping timeout: 264 seconds]
orivej_ has quit [Ping timeout: 260 seconds]
orivej has joined #picolisp
rob_w has quit [Quit: Leaving]
Blukunfando has joined #picolisp
rob_w has joined #picolisp
orivej has quit [Ping timeout: 265 seconds]
orivej has joined #picolisp
orivej_ has joined #picolisp
orivej has quit [Ping timeout: 264 seconds]
orivej_ has quit [Ping timeout: 260 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]