-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feedback and the micro-benchmarks that made me happy and sad #28
Comments
Could you file a separate bug, ideally with a small module reproducing the problem, for the "nil" crash? |
I suspect the crash is due to returning the static nil symbol that was interned in a different function. We can't do that with the frame-based memory model we have now. I've updated all example to reflect that in one of my last commits. |
@aaptel, that explains it. You overlooked the What do you think about the other two issues (reload and read-only string perf)? |
I will update the string example module, thanks. I don't know if we can make module reloadable safely. I would suggest reusing the test module infrastucture for now (starting emacs in batch mode basically). Look at the modhelp.py script the module folder. Run I find this code/edit test/run loop convenient enough myself but I agree it might not be suitable for interactive stuff. You can try adding an -i/--interactive flag to modhelp to run a graphical emacs maybe? |
It doesn't need to be safe - the intended use is by module writers, not users. It could even be a compilation flag if that matters. I'm sympathetic to TDD, but I'm also quite fond of LISP and interactive development. fwiw, clojure has some history with a similar problem, i.e unless you're careful you could end up in a dirty state when restarting a system inside a running JVM, but because you really want to avoid the overhead of a restart (in clojure's case, of the JVM), it's just a matter of mapping out the dangers and establishing coding conventions to avoid them. I'd be quite happy occasionally crashing Emacs during module dev if, with a little more care, I can avoid the restarts altogether. |
@aaptel, if you're uninclined to provide an |
I've been following this on emacs-devel and am really looking forward to having dynamic modules support available in (hopefully) 25.1. Thank you for your efforts to get this implemented after so many years in feature limbo...
A couple of issues I've hit when trying to write a module:
module-load
against an already loaded module is a no-op. This is very inconvenient when iterating on c code as evey change involved restarting emacs (for interactive use). Some kind of reload funcitonality (as unsafe as it might be) would make writing modules much more pleasent.Qnil
) crashes emacs when it tries to print the returned value.I'd like to suggest (as #24 (comment) has) that it would be very useful to have low-overhead access (for read-only) to lisp strings, my experiment show the overhead currenty involved negates a lot of the potential benefit of using a module for anything that involves lots of individual string processing.
Some crude micro-benchmarking results:
-O2
): 30ms.copy-string-contents
: 120ms.Measured with
benchmark-run
on a modified version ofmodt-string
which avoided doing amalloc
per call and returns aQnil
instead of constructing a string return value.Although this is still considerably faster than the elisp version (yay!), it is still too slow for some concrete applications I have in mind (darn!), and for function which really need only read access to the string, and can guarantee against/deal with non-ascii contents, the 7-8x slowdown involved in the extra string copy, conversion, and GC seem entirely avoidable.
The text was updated successfully, but these errors were encountered: