Tips about implementing parse_transform
- First write code to generate in a file, and compile it using
erlc -Sto check what the compiled forms look like - Use [https://github.com/esl/parse_trans]
Tips about implementing parse_transform
erlc -S to check what the compiled forms look like| #!/bin/bash | |
| # Pull this file down, make it executable and run it with sudo | |
| # wget https://gist.githubusercontent.com/bryanhunter/10380945/raw/build-erlang-17.0.sh | |
| # chmod u+x build-erlang-17.0.sh | |
| # sudo ./build-erlang-17.0.sh | |
| if [ $(id -u) != "0" ]; then | |
| echo "You must be the superuser to run this script" >&2 | |
| exit 1 | |
| fi |
| EStone test completed | |
| **** CPU speed UNKNOWN MHz **** | |
| **** Total time 1.740884613333333 seconds **** | |
| **** ESTONES = 260159.54 **** | |
| {'ESTONES',2.601595e+05} | |
| Title Millis Estone % Loops | |
| list manipulation 52.07 29171.60 7 6400 | |
| small messages 391.62 7915.86 10 1515 |
| #!/usr/bin/env escript | |
| % -*- mode: erlang -*- | |
| main([BeamFile]) -> | |
| {ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(BeamFile,[abstract_code]), | |
| io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]). |
| # You will need to make this file executable (chmod u+x) and run it with sudo | |
| apt-get update | |
| apt-get --fix-missing -y install build-essential m4 libncurses5-dev libssh-dev unixodbc-dev libgmp3-dev libwxgtk2.8-dev libglu1-mesa-dev fop xsltproc default-jdk | |
| mkdir -p /src/erlang | |
| cd /src/erlang | |
| wget http://www.erlang.org/download/otp_src_R15B01.tar.gz | |
| tar -xvzf otp_src_R15B01.tar.gz | |
| chmod -R 777 otp_src_R15B01 | |
| cd otp_src_R15B01 | |
| ./configure |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |