What would be the best code, if possible one-liner, to benchmark the performance of newLisp?
Greetings
Peter
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote
peter@AsteroidRider:~/installation/newlisp-10.0.0$ make -f makefile_linux64LP64
gcc -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DLINUX -DNEWLISP64 -DREADLINE newlisp.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DLINUX -DNEWLISP64 -DREADLINE nl-symbol.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DLINUX -DNEWLISP64 -DREADLINE nl-math.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DLINUX -DNEWLISP64 -DREADLINE nl-list.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DLINUX -DNEWLISP64 -DREADLINE nl-liststr.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DLINUX -DNEWLISP64 -DREADLINE nl-string.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DLINUX -DNEWLISP64 -DREADLINE nl-filesys.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DLINUX -DNEWLISP64 -DREADLINE nl-sock.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DLINUX -DNEWLISP64 -DREADLINE nl-import.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DLINUX -DNEWLISP64 -DREADLINE nl-xml.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DLINUX -DNEWLISP64 -DREADLINE nl-web.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DLINUX -DNEWLISP64 -DREADLINE nl-matrix.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DLINUX -DNEWLISP64 -DREADLINE nl-debug.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-strict-aliasing -Wno-long-long -c -O2 -g -DLINUX -DNEWLISP64 -DREADLINE pcre.c
gcc newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o pcre.o -g -lm -ldl -lreadline -lncurses -o newlisp
strip newlisp
peter@AsteroidRider:~/installation/newlisp-10.0.0$ file newlisp
newlisp: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), stripped
(begin
(set 'GL_LIB "/usr/lib64/libGL.so")
(set 'GLUT_LIB "/usr/lib64/libglut.so"))
Quote
peter@AsteroidRider:~/installation/newlisp-10.0.0/examples$ file /usr/lib64/libGL.so
/usr/lib64/libGL.so: symbolic link to `libGL.so.1'
peter@AsteroidRider:~/installation/newlisp-10.0.0/examples$ file /usr/lib64/libGL.so.1
/usr/lib64/libGL.so.1: symbolic link to `libGL.so.169.09'
peter@AsteroidRider:~/installation/newlisp-10.0.0/examples$ file /usr/lib64/libGL.so.169.09
peter@AsteroidRider:~/installation/newlisp-10.0.0/examples$ file /usr/lib64/libGL.so.169.09/usr/lib64/libGL.so.169.09: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), stripped
peter@AsteroidRider:~/installation/newlisp-10.0.0/examples$ file /usr/lib64/libglut.so
/usr/lib64/libglut.so: symbolic link to `libglut.so.3'
peter@AsteroidRider:~/installation/newlisp-10.0.0/examples$ newlisp opengl-demo.lsp
peter@AsteroidRider:~/installation/newlisp-10.0.0/examples$
peter@AsteroidRider:~/installation/newlisp-10.0.0/examples$ file /usr/lib64/libglut.so.3
/usr/lib64/libglut.so.3: symbolic link to `libglut.so.3.7.1'
peter@AsteroidRider:~/installation/newlisp-10.0.0/examples$ file /usr/lib64/libglut.so.3.7.1/usr/lib64/libglut.so.3.7.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), stripped
Quote
[peter:apps]$ cat test.lsp
(println "Hello world")
(exit)
[peter:apps]$
[peter:apps]$ newlisp test.lsp
Hello world
[peter:apps]$ newlisp /usr/share/newlisp/util/link.lsp
newLISP v.10.0.0 on OSX IPv4, execute 'newlisp -h' for more info.
> (link "/usr/bin/newlisp" "bla" "test.lsp")
true
> (exit)
[peter:apps]$
[peter:apps]$ chmod 755 bla
[peter:apps]$ ./bla
newLISP v.10.0.0 on OSX IPv4, execute 'newlisp -h' for more info.
>
>
Quote
(get-url "http://www.nuevatec.com">http://www.nuevatec.com " 3000)
The optional argument int-timeout can specify a value in milliseconds. If no data is available from the host after the specified timeout, get-url returns the string ERR: timeout. When other error conditions occur, get-url returns a string starting with ERR: and the description of the error.
(get-url "http://11.12.13.16" 50)
#!/usr/bin/newlisp
#
# Testing GtkMozEmbed - PvE - april 22, 2008 GPL.
#
# A very minimal webbrowser! Use with GTK-server 2.2.4 or later.
# Change paths to configfile and/or GTK-server where necessary.
#
#-------------------------------------------------------------------
(global 'in 'out)
(set 'cfgfile (open "/etc/gtk-server.cfg" "read"))
(cond ((not cfgfile)(println "No GTK-server configfile found! Exiting...")(exit)))
(while (read-line cfgfile)
(when (starts-with (current-line) "FUNCTION_NAME")
(set 'func (chop ((parse (current-line) " ") 2)))
(set 'lb (append {(lambda()(setq s "} func {")(dolist (x (args))(setq s (string s " " x)))(write-line s out)(read-line in))}))
(constant (global (sym func)) (eval-string lb))))
(close cfgfile)
(constant (global 'NULL) "NULL")
# ---------------------------------------------------------------
# IMPORTANT!
#
# The script 'run-mozilla.sh' sets some environment
# variables before executing the
# webbrowser binary. The 'gtkembedmoz' widget
# must be linked together with the other
# Mozilla libs using 'LD_LIBRARY_PATH' in order
# to be used successfully.
#
# ---------------------------------------------------------------
(set 'LIB ((exec "dirname `locate libgtkembedmoz.so -n 1`") 0))
(env "LD_LIBRARY_PATH" LIB)
# Setup standalone gtk-server using STDIN
(map set '(in gtkout) (pipe))
(map set '(gtkin out) (pipe))
(process "/usr/bin/gtk-server stdin" gtkin gtkout)
# Define minimal GUI
(gtk_init NULL NULL)
(set 'win (gtk_window_new "0"))
(gtk_window_set_title win {"A minimal webbrowser!"})
(gtk_window_set_position win 1)
(gtk_window_set_default_size win 700 500)
(gtk_window_set_icon_name win "mozilla")
# Set the componentpath of gtkembedmoz also
(gtk_moz_embed_set_comp_path LIB)
# Store a temporary profile in /tmp so my profile will be save
(gtk_moz_embed_set_profile_path "/tmp" "mozilla")
# Create the widget
(set 'moz (gtk_moz_embed_new))
(gtk_container_add win moz)
# Load some URL
(gtk_moz_embed_load_url moz "http://www.newlisp.org")
# Show it all
(gtk_widget_show_all win)
# Mainloop
(do-until (= (gtk_server_callback "wait") win))
# Exit GTK and newLisp
(gtk_server_exit)
(exit)
newLISP v.9.3.0 on Linux, execute 'newlisp -h' for more info.
> (set 'socket (net-connect "10.227.180.20" 13))
3
> (net-receive socket 'buf 1024)
27
> buf
"07 APR 2008 15:19:12 CESTrn"
> socket
3
> (net-close socket)
true
> socket
3
value+=5
(set 'value (+ value 5))
(set 'value (+= 5))
- or even better:
(+= 'value 5)
Quote
peter[~]$ echo "help" | awk '{print}'
help
peter[~]$ echo "help" | sed {}
help
peter[~]$ echo "help" | cut -f1
help
peter[~]$ echo "help" | newlisp -e "(println)"
nil
STRING="Hello1 Hello2 Hello3"
awk -v VAR="$STRING" 'BEGIN {print VAR}'
newlisp -e "(silent (println "Hello1 Hello2 Hello3"))"
NEWLISP_LINE='(println "${STRING}")(exit)'
newlisp -e $NEWLISP_LINE
Quote
missing parenthesis : "...(println "
NEWLISP_LINE="(println $STRING)(exit)"
NEWLISP_LINE='(println $STRING)(exit)'
Quote
peter[~]$ newlisp
newLISP v.9.3.2 on Linux IPv4, execute 'newlisp -h' for more info.
> (set 'xml "<xml><DATABASE><This><FRUIT><NAME>apple</NAME><COLOR>red</COLOR><PRICE>0.80</PRICE></FRUIT></DATABASE>")
"<xml><DATABASE><This><FRUIT><NAME>apple</NAME><COLOR>red</COLOR><PRICE>0.80</PRICE></FRUIT></DATABASE>"
> (xml-parse xml (+ 1 2 4 8 16) A)
Segmentation error
peter@AsteroidRider:~$ newlisp
newLISP v.9.2.17 on Linux, execute 'newlisp -h' for more info.
> (sys-info)
(362 268435456 358 1 0 140733193390080 9217 1)
> (nth 6 (sys-info))
140733193397249
> (nth 7 (sys-info))
140733193388033
> (nth 8 (sys-info))
list index out of bounds
> (nth 5 (sys-info))
140733193390080
Quote
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:Documents and Settingspeter>cd
C:>cd newlisp
C:newlisp>newlisp
newLISP v.9.2.11 on Win32, execute 'newlisp -h' for more info.
> (env "NEWLISPDIR")
"C:\Program Files/newlisp"
> (exit)
C:newlisp>set NEWLISPDIR="C:\newlisp"
C:newlisp>set NEWLISPDIR
NEWLISPDIR="C:\newlisp"
C:newlisp>newlisp
newLISP v.9.2.11 on Win32, execute 'newlisp -h' for more info.
> (env "NEWLISPDIR")
"C:\Program Files/newlisp"
>
Quote
peter[~]$ newlisp
newLISP v.9.2.11 on Linux, execute 'newlisp -h' for more info.
> (set 'example '("a" "b" "c" "d" "e"))
("a" "b" "c" "d" "e")
>
> (length example)
5
> (nth 4 example)
"e"
> (nth 5 example)
"e"
> (nth 6 example)
"e"
> (nth 0 example)
"a"
> (nth -1 example)
"e"
> (nth -2 example)
"d"
Quote
peter[~]$ newlisp
newLISP v.9.2.11 on Linux, execute 'newlisp -h' for more info.
> (set 'example '("a" "b" "c" "d" "e"))
("a" "b" "c" "d" "e")
>
> (length example)
5
> (nth 4 example)
"e"
> (nth 5 example)
"a"
> (nth 6 example)
"b"
> (nth 7 example)
"c"
> (nth 0 example)
"a"
> (nth -1 example)
"e"
> (nth -2 example)
"d"
> (nth -3 example)
"c"
Quote
On Win32 function 'directory?' now will accept training slahes '' or '/'
before it would always fails on trailing slashes
Quote
c:Scripts>newlisp
newLISP v.9.2.10 on Win32, execute 'newlisp -h' for more info.
> (directory? "c:\temp")
true
> (directory? "c:\temp\")
true
> (directory? "c:\")
nil
> (directory? "c:")
string token too long : "c:")rn"
> (directory? "c:\")
nil
>
Quote
newLISP v.9.2.10 on Linux, execute 'newlisp -h' for more info.
> (set 'S "abc.def.ghi")
"abc.def.ghi"
> (ends-with S "ghi" 1)
true
> (ends-with S "def|ghi" 1)
nil
>
Quote
> (ends-with S "def$|ghi$" 1)
true
Quote
newLISP v.9.2.0 on Linux, execute 'newlisp -h' for more info.
> (directory? "/tmp")
true
> (directory? "/tmp/")
true
Quote
newLISP v.9.2.0 on Win32, execute 'newlisp -h' for more info.
> (directory? "C:\Temp")
true
> (directory? "C:\Temp\")
nil
Quote
> (delete-file "somedir/*.*")
nil