<manualcrank>
translated directly to c++ using unordered_set for the hash table takes 0.06s
<manualcrank>
what's taking so long?
<manualcrank>
(the only suspects in this case seem (read-line) and hash table stuff)
akoana has joined #lisp
<no-defun-allowed>
Have you tried using SBCL's profiler?
<no-defun-allowed>
Though it will slow down the program a bit, it will show you the slow function calls.
<xantoz>
I would try using a bloom filter for that
<manualcrank>
i don't know how to use the profiler yet
<manualcrank>
declaim speed 3 safety 0 has no effect
<no-defun-allowed>
The interface looks like TRACE, use (sb-profile:profile foo bar baz) to profile foo bar and baz, sb-profile:unprofile to unprofile, and (sb-profile:report) to see the report
<manualcrank>
so the problem with that is i don't have access to the data set
<manualcrank>
only example data shown in problem statement, which is too small
<manualcrank>
when a problem is submitted you can see its progress though
<no-defun-allowed>
Do you get access to the program's output?
<manualcrank>
no
quazimodo has quit [Ping timeout: 245 seconds]
<no-defun-allowed>
I don't know how the problem goes, but could you try to generate some input data?
<manualcrank>
i guess :-(
<manualcrank>
was hoping others have experience using lisp at competitive programming sites
<manualcrank>
who could say "yeah, i/o is slow" or "yeah, your algorithm sux"
<shka__>
manualcrank: without profiler it is imposible to tell what's going on (unless algorithm sucks)
<xantoz>
like I said, try a bloom filter
<xantoz>
for the algo, that is
<manualcrank>
again, though, direct translation of algo to c++ = 0.06s (like all the other c++ soln's)
<shka__>
i doubt that this is a solution
<xantoz>
would cons significantly less
themsay has quit [Read error: Connection reset by peer]
<shka__>
manualcrank: i would generate data, put it in the vector, eleminate read-lines and see how this works then
<shka__>
xantoz: not really
<shka__>
he is already reserving proper size of the hash-table so i don't think that realocations are a problem
<no-defun-allowed>
Consing is pretty cheap though. I would profile a bunch first.
<manualcrank>
u mean bulk read the file and then parse (instead of read-line)?
<shka__>
no-defun-allowed: hash-table reallocation can be quite brutal actually
<no-defun-allowed>
true
<shka__>
manualcrank: yes, eleminate IO from the profile
themsay has joined #lisp
<shka__>
it is my best bet on why you are getting such a bad performance
<manualcrank>
i'll try that
<xantoz>
is there some way to re-use the memory when reading the strings in lisp? (in C I would just use stack-alloced fixed-size arrays for current and previous word)
<shka__>
xantoz: i am almost certain that memory is not issue at all in this program
<no-defun-allowed>
read-sequence? Still don't think that'd be the bottleneck and you should investigate further.
<shka__>
and if you want to, (setf (aref string index) char) is possible
<xantoz>
I was thinking that read-line would create lots of transient objects, but I might be wront
ebrasca has quit [Remote host closed the connection]
donotturnoff has joined #lisp
<manualcrank>
i'll generate some data for profiling purposes, then bulk i/o
akoana has left #lisp ["Leaving"]
<manualcrank>
not tonight though
<shka__>
manualcrank: if words are short (8 chars) you probabbly won't come close to C++ anyway but i agree that 1.2s is suspicious
<shka__>
manualcrank: good night
<manualcrank>
problem limits are 100,000 words between 1 and 20 characters
<shka__>
ok
<manualcrank>
so i'll try 100,000 1 character words, then 100,000 20 character words
<shka__>
manualcrank: yeah, this sounds about right
<manualcrank>
i'll read the whole file into a string tomorrow. good night.
SaganMan has joined #lisp
manualcrank has quit [Quit: WeeChat 1.9.1]
test1600 has joined #lisp
lavaflow_ has quit [Ping timeout: 244 seconds]
crystalball has joined #lisp
crystalball has quit [Remote host closed the connection]
catalinbostan has joined #lisp
szmer has joined #lisp
v0|d has joined #lisp
igemnace has quit [Ping timeout: 248 seconds]
mindthelion has joined #lisp
SaganMan has quit [Ping timeout: 268 seconds]
mindthelion has quit [Read error: Connection reset by peer]
pjb has quit [Ping timeout: 252 seconds]
techquila has quit [Ping timeout: 252 seconds]
igemnace has joined #lisp
techquila has joined #lisp
SaganMan has joined #lisp
<dmiles>
karlosz: did you get sb-heapdump to work?
* dmiles
is working on gettign CLOAK to work
<dmiles>
any advice or dis/encouragement for other is appriciated
jmercouris has joined #lisp
<jmercouris>
for boolean variable naming, what convention is favored by yourself or the community?
<minion>
jmercouris, memo from beach: Because it only removes from the end, whereas subseq can simultaneously remove from the start and from the end.
<jmercouris>
ah, that is a good point
<jmercouris>
beach: however, I can't imagine myself remembering the spec so well and keeping that in mind
<flip214>
who's maintaining 5am? I've got a feature request resp. bug report: when PARSE-INTEGER reports an error, :START isn't taken into account - so 5am happily reports "no digits in string "1234...""
orivej has joined #lisp
<scymtym>
flip214: isn't that an issue in your CL implementation rather than 5am?
<flip214>
scymtym: no, SBCL's error message is different.
<flip214>
5am "helpfully" replaces it.
<varjag>
is there a way to associate compilation in certain buffers to certain SLIME connections?
donotturnoff has quit [Remote host closed the connection]
SaganMan has quit [Ping timeout: 245 seconds]
SaganMan has joined #lisp
<scymtym>
flip214: i see. do you know where that happens? i couldn't immediately find any references to PARSE-INTEGER in 5am's code
<jmercouris>
for boolean variable naming, what convention is favored by yourself or the community?
xkapastel has joined #lisp
<scymtym>
flip214: SBCL has both error messages: (parse-integer "12345" :start 5) => "no non-whitespace char…" (parse-integer "12345-" :start 5) => "no digits in string …"
zotan has quit [Ping timeout: 258 seconds]
zotan has joined #lisp
dmiles has quit [Ping timeout: 272 seconds]
logicmoo has joined #lisp
aeth has quit [Ping timeout: 248 seconds]
aeth has joined #lisp
sjl has quit [Ping timeout: 248 seconds]
mingus has quit [Ping timeout: 248 seconds]
grms has quit [Ping timeout: 272 seconds]
sjl has joined #lisp
logicmoo is now known as dmiles
<flip214>
scymtym: yes, just reproduced that. sorry for the bad error report, that comes from trying to offload things -- my recursion depth was nearly exceeded.
SaganMan has quit [Ping timeout: 258 seconds]
kajo has joined #lisp
catalinbostan has quit [Read error: Connection reset by peer]
python476 has joined #lisp
Lycurgus has quit [Quit: Exeunt]
crystalball has joined #lisp
m00natic has joined #lisp
<jackdaniel>
jmercouris: whateverp
<jackdaniel>
or things-got-wild-p
<jmercouris>
jackdaniel: here is a question for you, (a counter argument I heard), P stands for predicate, and predicates are only functions, is this true?
<jackdaniel>
it is a predicate result, so it doesn't bother me at all
<jmercouris>
interesting, a good point
<jackdaniel>
in semantics (at least in Polish language) predicate is either an expression or result of such expression
<jmercouris>
the noun form in english is "predication"
<jackdaniel>
the best thing about -p suffix is that you may expand it to both ,)
<shka__>
it is like emacs scratch buffer but instead of evaluating emacs lisp it is for evaluating common lisp
<shka__>
same concept
<jmercouris>
right, it makes a lot of sense
<jmercouris>
especially if you plan on taking the code from the REPL into actual source
<shka__>
it is useful
<jmercouris>
can I just add it to the list in slime-setup and it will work?
<shka__>
i guess?
<shka__>
i am using spacemacs and it comes with it out of the box
<jmercouris>
ok, that is what it required
<shka__>
slime-eval-print-last-expression is love
<shka__>
;-)
<jmercouris>
I find slime contribs to be very counter-intuitive
<jmercouris>
I don't understand why all contribs are not just enabled by default
<shka__>
well, not question i can answer
jmercouris has quit [Ping timeout: 248 seconds]
<jackdaniel>
imagine a contrib implementing a prompt in a form of a nyan cat
<jackdaniel>
while I'm sure many people would be delighted to have it I wouldn't load such contrib myself, hence loading it by default may be a bit problematic (for me)
ggole has joined #lisp
charh has quit [Remote host closed the connection]
varjag has quit [Quit: ERC (IRC client for Emacs 25.2.2)]
iovec has joined #lisp
bexx has quit [Remote host closed the connection]
heisig has quit [Quit: Leaving]
powerbit has quit [Ping timeout: 258 seconds]
xkapastel has quit [Quit: Connection closed for inactivity]
manualcrank has joined #lisp
Inline has joined #lisp
Lycurgus has joined #lisp
mindCrime has joined #lisp
Bike has joined #lisp
mindCrime has quit [Read error: Connection reset by peer]
mindCrime has joined #lisp
sjl_ has joined #lisp
sjl_ has quit [Client Quit]
sjl_ has joined #lisp
cosimone has joined #lisp
xkapastel has joined #lisp
cosimone has quit [Quit: WeeChat 2.4]
bobby has quit [Read error: Connection reset by peer]
jprajzne has quit [Quit: Leaving.]
powerbit has joined #lisp
Lycurgus has quit [Ping timeout: 258 seconds]
warweasle has joined #lisp
rippa has joined #lisp
varjag has joined #lisp
travv0 has joined #lisp
themsay has quit [Ping timeout: 248 seconds]
themsay has joined #lisp
ebrasca has joined #lisp
shka_ has joined #lisp
<random-jellyfish>
new to lisp here
<random-jellyfish>
I want to return a pair of random values from a function
<Bike>
kind of a pain, but you oughtnt need to rebuild
<jmercouris>
unexport could be the ticket
<jmercouris>
I'll give it a try the next time this comes up, thank you Bike
<Bike>
this also applies to other package alterations sbcl complains about. nothing defpackage does is impossible to do outside of defpackage
<jmercouris>
it is however convenient to use defpackage at the top of a file
<jmercouris>
maybe it would be another style to export symbols directly after they are defined
<jmercouris>
does anyone do things that way?
actuallybatman has joined #lisp
<jmercouris>
like if they have a defun they want to export, they have the export right next to it
<sjl_>
cl-annot does something like this. I don't personally like it, but I guess some people do https://github.com/m2ym/cl-annot
<sjl_>
@export (defun foo ...)
<jmercouris>
I didn't like them in Python, and I don't like decorators in LISP either
<jmercouris>
I just meant something as simple as (export 'foo) right after (defun foo)
<sjl_>
I mean, you could just write the (export 'foo) before
<jmercouris>
or even before it, on the precedening line
<sjl_>
yeah
<jmercouris>
would people curse my code or no?
<sjl_>
I personally prefer the one-big-package.lisp-file approach. I like that it makes you lay out the API of each package explicitly in a single place. I like that I know where to go to see a quick overview of a package's API, rather than having to grep through source files for `export`
<sjl_>
But to each their own.
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<jmercouris>
sjl_: so you make a package.lisp file?
<jmercouris>
and you include all of your defpackages there?
<jmercouris>
I do that usually, but I'm working with a caveman2 skeleton project and trying to understand/adapt to Eitaro's style, I may just nix it in the end and go back to the package.lisp approach
LiamH has joined #lisp
<jmercouris>
its just that before I completely discount something, I like to at least try it and understand
<karlosz>
dmiles: why are you asking me?
moei has joined #lisp
ebrasca has quit [Remote host closed the connection]
<markasoftware>
i have an array of :element-type 'boolean. However, each element is taking up many bytes of memory (maybe 8?) in sbcl. Is there any way to decrease this memory usage to 1-2 bytes per element?
<sjl_>
not if you want to keep the elements as booleans. A boolean in CL is one of the symbols T or NIL, SBCL uses a pointer to refer to the symbol.
<sjl_>
But you could use :element-type 'bit and then use (zerop ...) or (plusp ...)
<aeth>
in SBCL (upgraded-array-element-type 'boolean) => T
random-jellyfish has quit [Ping timeout: 256 seconds]
<aeth>
I use bits with (zerop foo) and (= 1 foo) and flip the bit with (if (zerop foo) 1 0) etc.
<aeth>
I guess there's nothing stopping an implementation from using booleans and storing them as bits, and wrapping every access in a conversion, but I don't think any do.
<aeth>
i.e. wrapped like (= 1 (aref foo 0))
<aeth>
(and for setting (if foo 1 0))
HDurer has quit [Remote host closed the connection]
<sjl_>
that would be all kinds of fun with displaced arrays
<sjl_>
I'm sure it's possible, but yeah, I don't think any implementations do it. Generally if you say "I want to store X" it will use a scheme that actually does store X.
<Xach>
markasoftware: a bit vector would be more compact in memory at the cost of some interpretation of the values as booleans.
* Xach
catches up to sjl 10 minutes ago
<markasoftware>
ok, i'll use bit
<markasoftware>
that seems like the right solution, tahnks!
<Xach>
on the other hand, memory is so cheap! who cares! cons more!!
jmercouris has quit [Ping timeout: 272 seconds]
lavaflow_ has joined #lisp
phoe has quit [Ping timeout: 252 seconds]
<dlowe>
memory is cheap, but it does cost cpu cycles from g
<dlowe>
gc
<dlowe>
maybe not as much as the bit access though
m00natic has quit [Remote host closed the connection]
<markasoftware>
haha, i'm doing project euler, cons would eat everything
simendsjo has joined #lisp
terpri_ has quit [Read error: Connection reset by peer]
<aeth>
Yeah, I use bit vectors in my prime sieve which is used for quite a few Project Euler problems. And that's a place where bits-over-booleans really, really matter.
<aeth>
I could probably cache the primes, but then that would go against the spirit of trying to do things in < 1 second if possible.
<aeth>
I should probably publish my prime sieve
szmer has quit [Ping timeout: 244 seconds]
cosimone has joined #lisp
travv0 has left #lisp [#lisp]
rpg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Lycurgus has joined #lisp
nanoz has joined #lisp
donotturnoff has joined #lisp
simendsjo has quit [Ping timeout: 258 seconds]
gareppa has joined #lisp
gareppa has quit [Remote host closed the connection]
rpg has joined #lisp
<sjl_>
Yeah, for Euler I sieve and store the primality of the first 100 million odd numbers in a bit vector, and use miller rabin to check primality for numbers larger than 200000000
chipolux has joined #lisp
<aeth>
Interesting. I turn my sieve into a simple-array fixnum afterwards. Maybe I should hold onto the intermediate bit vector somewhere.
<sjl_>
An array of just the primes, which you then bisect to check primality?
<sjl_>
There are ~11,000,000 primes below 200,000,000. With an array of (unsigned-byte 64) that's roughly 80mb to store them all. If you store the odd numbers below 200,000,000 in a bit vector that's ~11mb, and lookup is (aref v (ash n 2))
<sjl_>
er, (ash n -1)
<sjl_>
of course you don't need 64 bits to store numbers < 200,000,000...
<aeth>
It doesn't look like I do a lookup of primes
<aeth>
I mean, I don't do a primep
<aeth>
Is that used in a later problem?
<sjl_>
But I still think the bit vector method uses less space, and the lookup is O(n) instead of O(log(n))
<sjl_>
"later" than what?
<sjl_>
I use it in 35
<sjl_>
in 27 too
<sjl_>
37, 41, 50, 51
<sjl_>
and more after that
<sjl_>
honestly now that I have a machine with 64gb of RAM I should probably be a little less stingy on the precomputation. Though mostly it's annoying that it takes a while to quickload the system. I should probably make it so the primality array gets compiled into the FASL so it can load without recomputing it every time.
<aeth>
it doesn't look like I did those
terpri has joined #lisp
<sjl_>
I sort by difficulty and have been trying to mostly just go in order
<sjl_>
friend code 48257_AAgoR50jsmK1HqPwtcQJZV9iqzIuk6ay if any other Lisp people do Project Euler
<aeth>
I haven't been doing it recently
cosimone has quit [Quit: WeeChat 2.4]
alexanderbarbosa has quit [Remote host closed the connection]
phoe has joined #lisp
Achylles has quit [Remote host closed the connection]
kajo has quit [Ping timeout: 258 seconds]
kajo has joined #lisp
themsay has quit [Read error: Connection reset by peer]
sauvin has quit [Ping timeout: 248 seconds]
themsay has joined #lisp
nanoz has quit [Ping timeout: 248 seconds]
kajo has quit [Ping timeout: 252 seconds]
hvxgr_ has quit [Ping timeout: 252 seconds]
MichaelRaskin has joined #lisp
dacoda has joined #lisp
paul0 has quit [Read error: Connection reset by peer]
dacoda has quit [Ping timeout: 248 seconds]
rumbler31__ has quit [Read error: Connection reset by peer]
Folkol has joined #lisp
ggole has quit [Quit: Leaving]
blackswan has joined #lisp
orivej has joined #lisp
<blackswan>
how many people would you estimate have written tetris clones in lisp?
<Bike>
Six
alexanderbarbosa has joined #lisp
<blackswan>
did you google it?
<blackswan>
because that's the number of apparently unique repositories referenced on the first two pages when i search for "tetris lisp"
<Bike>
No, I based it on nothing at all.
<blackswan>
i was wondering whether you actually counted
simendsjo has joined #lisp
iovec has quit [Quit: Connection closed for inactivity]
<Bike>
nope. six just seemed like a good number
<Bike>
and as it turned out it was
v88m has joined #lisp
<blackswan>
six is an excellent number, as i'm sure baltar would agree
warweasle has quit [Quit: rcirc on GNU Emacs 24.4.1]
random-nick has quit [Read error: Connection reset by peer]
kajo has joined #lisp
<moldybits>
blackswan: in #lispgames 2 of us are currently writing one each
paul0 has joined #lisp
flazh has joined #lisp
nowhere_man has joined #lisp
<aeth>
If I wrote a falling tetromino game I would make sure that no one confuses it with Tetris®, the property of the notoriously litigious The Tetris Company
random-nick has joined #lisp
shka_ has quit [Ping timeout: 272 seconds]
<blackswan>
i would not, because nobody cares about mine. i think i wrote three of them in the 80s. one was for the symbolic lisp machine.
<blackswan>
the other two were not in lisp.
Bike has quit []
<dmiles>
karlosz: google showed you asking the same question a while back
lime[_] is now known as uplime
<karlosz>
dmiles: oh, okay. im not really sure what you are asking me though
<dmiles>
well i am trying to build cloak right now (i think you were as well once) and you wondered about if sb-heapdump was working.. sinc ethat ius what cloak uses
<dmiles>
it was left off inconclusice.. i couldnt tell if you succeeded or not
<dmiles>
2018-01-10T15:02:33Z karlosz: do you happen to know if sb-heapdump is still working?
<dmiles>
2018-01-10T15:02:43Z karlosz: i could do that as well in this thing
<karlosz>
dmiles: i have no idea what cloak is. i am pretty sure i was working on some sbcl internals related thing
ober has joined #lisp
<dmiles>
oh maybe unrelated to CLOAK as i am rereading
<ober>
(CFFI::TRY-FOREIGN-LIBRARY-ALTERNATIVES THNAPPY::LIBSNAPPY ("libsnappy.so" "libsnappy.so.1" "libsnappy.dylib") NIL) what would keep sbcl from finding a lib that exists in /lib, /lib64, /usr/lib, and ldconfig has been run.
<dmiles>
question i cant find sb-heapdump anywhere
<mgsk>
Does anybody recall the package that makes presentation slides? I seem to remember a cool one floating around recently, where you could interactively change the slideshow as you presented.
nicksmaddog has quit [Remote host closed the connection]
nicksmaddog has quit [Remote host closed the connection]
nicksmaddog has joined #lisp
zhlyg has quit [Ping timeout: 248 seconds]
orivej has quit [Ping timeout: 246 seconds]
wigust- has quit [Read error: Connection reset by peer]
wigust has joined #lisp
jack_rabbit has joined #lisp
nirved_ has quit [Read error: Connection reset by peer]
nicdev has quit [Quit: ERC (IRC client for Emacs 26.1)]
nicdev has joined #lisp
nicksmaddog has quit [Ping timeout: 252 seconds]
krwq has joined #lisp
Lycurgus has joined #lisp
random-nick has quit [Ping timeout: 246 seconds]
sjl_ has quit [Quit: WeeChat 2.3-dev]
Folkol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
cosimone has quit [Ping timeout: 248 seconds]
Oladon has joined #lisp
elderK has joined #lisp
<elderK>
Hey all!
<elderK>
I was wondering if anyone here is currently in Christchurch, New Zealand?
varjag has quit [Quit: ERC (IRC client for Emacs 26.1)]
vms14 has joined #lisp
ym555 has quit [Quit: leaving...]
ym555 has joined #lisp
<Oladon>
I'm not, but I could pretend to be for the right price.
<Colleen>
Oladon: no-defun-allowed said at 2018.10.04 07:57:01: I put up the code on https://gitlab.com/theemacsshibe/mboard, it's very messy and bad so you get all the loose parts under WTFPL
<no-defun-allowed>
That was a while ago, Colleen
<Oladon>
Quite so...
<Oladon>
I have no memory of the context of that, but looking at the link helps :P
<Oladon>
Colleen: Tell no-defun-allowed I said thanks
<Colleen>
no-defun-allowed: Unknown command. Possible matches: 8, set, say, mop, get, time, tell, roll, help, deny,
<no-defun-allowed>
I think you were asking for a forum program a while ago.
<Oladon>
no-defun-allowed: :P
<Oladon>
Sounds right
<no-defun-allowed>
It shouldn't be too hard to make persistent, if you use a wrapper like Postmodern and you probably should change the software to use usernames the users chose and passwords.
nowhere_man has joined #lisp
<Oladon>
Coulda sworn I'd talked in here since then though :P
<Oladon>
no-defun-allowed: Looking it over now, seems reasonable.