I should really make this into a real plugin when I get time. But for now it will do.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CFLAGS=$(shell ./local/bin/xml2-config --cflags) | |
LDFLAGS=$(shell ./local/bin/xml2-config --libs) | |
foo: foo.o | |
$(CC) -o foo foo.o $(LDFLAGS) | |
foo.o: foo.c | |
$(CC) $(CFLAGS) -c -o foo.o foo.c | |
clean: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require "bundler/inline" | |
gemfile do | |
source "https://rubygems.org" | |
gem "builder" | |
gem "nokogiri" | |
gem "benchmark-ips" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CFLAGS=$(shell ./local/bin/xml2-config --cflags) | |
LDFLAGS=$(shell ./local/bin/xml2-config --libs) | |
foo: foo.o | |
$(CC) -o foo foo.o $(LDFLAGS) | |
foo.o: foo.c | |
$(CC) $(CFLAGS) -c -o foo.o foo.c | |
clean: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# coding: utf-8 | |
# Copyright 2022 Mike Dalessio | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and | |
# associated documentation files (the "Software"), to deal in the Software without restriction, | |
# including without limitation the rights to use, copy, modify, merge, publish, distribute, | |
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CFLAGS = -std=c89 | |
default: run | |
benchmark-O0.o: benchmark.c | |
$(CC) -O0 $(CFLAGS) -c -o benchmark-O0.o benchmark.c | |
lib-O0.o: lib.c | |
$(CC) -O0 $(CFLAGS) -c -o lib-O0.o lib.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# String Encoding, Nokogiri and You: A Primer | |
## First: A Few Thing To Consider | |
1. It is common for HTML pages to declare | |
1. Without information instructing it differently, Nokogiri's core library ([libxml2][]) will | |
[libxml2]: http://xmlsoft.org/ | |
[meta-bug]: https://bugzilla.gnome.org/show_bug.cgi?id=579317 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# | |
# find transitive reverse dependencies of nokogiri with more than a million downloads: "rdeps.rb nokogiri 1000000" | |
# | |
require "bundler/inline" | |
gemfile do | |
gem "json" | |
gem "ruby-progressbar" | |
end |
This gist reproduces a memory usage error in Ruby's iseq_peephole_optimize
.
- Compile Ruby with ASan (using
CFLAGS="-fsanitize=address -ggdb"
) - Turn off memory leak detection (which is not relevant)
export ASAN_OPTIONS=detect_leaks=0
- Run
ruby ./repro.rb
You should see something like:
before require
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XML Document parsing benchmark | |
user system total real | |
hpricot:xml:doc 10.160000 0.950000 11.110000 ( 11.144462) | |
hpricot2:xml:doc 0.950000 0.000000 0.950000 ( 0.953266) | |
nokogiri:compat:doc 0.220000 0.020000 0.240000 ( 0.238401) | |
nokogiri:xml:doc 0.170000 0.030000 0.200000 ( 0.200283) | |
XML XPath benchmarks (//status/text, //user/name) | |
user system total real | |
hpricot:xml:xpath 7.580000 1.150000 8.730000 ( 8.728314) |
NewerOlder