refactor macros, use memcpy

benchmarks to svg

png and svg perf