freenode/#lisp - IRC Chatlog
Search
6:55:22
slyrus
beach: assert doesn't call itself. I've found that testing frameworks can be very helpful for automatically/periodically running tests. Thins like cl-test-grid are very useful for quicklisp's libraries.
7:10:04
axion
I am trying to write a very simple function but falling short. I've outlined what I am trying to do here: http://paste.lisp.org/display/349572
7:28:50
beach
axion: It is probably better to allocate a new string and more characters over as you traverse the input.
7:33:59
axion
I am trying to not use third party librarie, else I would have used symbol-munger. The reason why is stupid...the other author of this software doesn't want dependencies for one-off functions.
7:35:44
beach
flip214: There is probably no point in taking the string-dowcase first. Might as well loop over the characters in the existing symbol name. It saves an allocation too.
7:48:29
beach
Instead of vector-push-extend, you might pre-allocate by counting the number of #\- in the original string.
9:31:57
dim
is there a known performance impact of doing (setf (aref batch i) new-value) for each array item compared to (make-array ...) then populating the new array and never referencing the previous one?
9:32:51
dim
either all the previous items in the array are individually collectable, or the array as a whole, but I don't have any idea about if there's a simpler case in terms of the GC here
9:38:49
shka
dim: not sure why (perhaps guys at #sbcl would provide better info) but it seems that arrays allocation in sbcl is somewhat cheap
10:18:51
jdz
If array element type is T then the array must be scanned on each GC; specialised arrays don't have to be scanned.
10:53:59
beach
dim: They are much more flexible. For example, you can redefine a class, and the semantics are well defined.
11:00:45
dim
but the main idea is that the program I am writing is then shipped as a binary to its users, and only runs for the task at hand (importing data)
11:02:07
dim
I had lots of discussions here where the spirit usually is that you're in front of SLIME or something equivalent when you run lisp code, whereas my users don't even know the program is written in lisp...
11:03:05
dim
anyway, thanks beach for the rationale, it's one I had heard before and I don't think it applies to my case here --- not I also use classes in other areas of the code
11:03:10
beach
dim: It is not about the end users. It's about being helpful to the developer. But if you don't need or want the help, that's up to you of course.
11:08:18
Bike
you could use the same logic as classes. it says structure redefinition has undefined consequences. so an implementation can define it to work like classes, or not
11:12:30
beach
That's what I mean by "support", i.e. what are the consequences in CCL when a struct is redefined. I didn't mean that C-M-x is allowed.
11:13:30
shka
well, if there is no all-to-familiar dialog from sbcl, i bet it just treats structs and classes the same
11:15:18
beach
shka: I seriously doubt that. Most implementations take advantage of the fact that it undefined in order to avoid the indirection of struct instances that is required for class instances.
11:18:13
beach
Once I get around to implementing structs in SICL, they will have the same nice properties as standard classes, simply because in SICL, every heap-allocated object except CONSes have a two-word header and a separate contents vector.
11:20:43
beach
shka: No the tag is in the pointer that points to it. The header contains a pointer to the class and a pointer to the contents vector (that I call a "rack").
11:22:33
specbot
upgraded-array-element-type: http://www.lispworks.com/reference/HyperSpec/Body/f_upgr_1.htm
11:24:14
beach
dim: An array (even a specialized one) must be represented by a pointer to some heap-allocated data, so if you want to store those in another array, that other array needs to be able to hold a pointer. Most implementations would then use T as the upgraded array element type.
11:26:06
shka
actually, some implementations extend upon the above and allow stack allocated arrays (but that's extension to standard)
11:30:39
dim
basically what I have is a batch of "rows" and each row is a set of columns, each column is a string
11:31:28
dim
then I prepare those columns for sending to PostgreSQL in the copy format, so then I (should) have a batch of simple-strings
11:38:26
jdz
I once tried PG's COPY thing, and it was way slower than doing queries (using postmodern).
11:44:25
dim
so you did one insert at a time? or prepared a batch with many rows in the value statement?
11:44:44
dim
see https://www.depesz.com/2007/07/05/how-to-insert-data-to-database-as-fast-as-possible/
11:45:14
dim
copy did the job in 17.02 seconds --- best possible way of inserting with multiple rows was using 100 rows per statement, 100 statements per transaction, using prepared statements – it did it's work in 37.73 seconds.
12:47:58
pjb
If you use defclass, normally you should write (or update) a update-instance-for-redefined-class method each time you modify the defclass.
12:49:57
pjb
On the other hand, when you write applications (executable images), you have so many times to deal with that it is just easier to avoid data crossing them. Ie. you have to minimize the data that is saved in your image, because most of it would become invalid anyways when the user reboots it.
12:50:35
pjb
all the open files and streams, all the foreign data, foreign libraries, etc. So adding structures to the mix is not a big deal.
12:51:10
pjb
Basically, defvar/defparameter with initial forms is a no-no, instead you set them to nil, and have a initialize function called at boot time.
12:53:16
dim
ok after some careful consideration and a host of optimisation, I now deal with :type '(simple-array (unsigned-byte 8))
12:53:47
pjb
Even the model we're using with slime, where we keep source files in an external file system to be recompiled/reloaded, imposes a development style and structure on the lisp image that is antinomic to the notion of persistent objects.
12:54:17
dim
(rather than using vector-push-extend I now count how many bytes are needed and pre-allocate the result at the right size already) (it costs an extra traversal but I think it's worth it in a memory hungry application)
12:55:14
dim
it's very rare that I have interactive things in cl-user (say) to play with in between calls and refactorings
13:04:15
dim
I usually don't, I have test cases that are more like integration tests than unit-tests, those will recreate all I need
13:04:42
dim
e.g. with pgloader I test my edits with doing a full SQLite or MySQL migration to PostgreSQL, those tests run for 2.5s and 0.6s resp.