Skip to content

Instantly share code, notes, and snippets.

@bararchy
Last active August 29, 2015 14:18
Show Gist options
  • Save bararchy/a3e7d8624318bc3ae840 to your computer and use it in GitHub Desktop.
Save bararchy/a3e7d8624318bc3ae840 to your computer and use it in GitHub Desktop.
Testing Gsub
require 'benchmark/ips'
file = File.read("/home/unshadow/Desktop/text.txt")
data = file
Benchmark.ips do |bench|
bench.config(time: 5, warmup: 2)
bench.report("#gsub") do
unused = file.gsub(/Setting up/,'o')
file = data
end
bench.report("#gsub!") do
file.gsub!(/Setting up/,'o')
file = data
end
bench.compare!
end
Setting up python-gobject-2 (2.28.6-12build1) ...
Setting up python-gobject (3.12.0-1ubuntu1) ...
Setting up python-openssl (0.13-2ubuntu6) ...
Setting up python-pam (0.4.2-13.1ubuntu3) ...
Setting up python-urllib3 (1.7.1-1ubuntu3) ...
Setting up python-requests (2.2.1-1ubuntu0.3) ...
Setting up python-serial (2.6-1build1) ...
Setting up run-one (1.17-0ubuntu1) ...
Setting up tcpd (7.6.q-25) ...
Setting up vnstat (1.11-2) ...
Installing new version of config file /etc/init.d/vnstat ...
Installing new version of config file /etc/vnstat.conf ...
* Starting vnStat daemon vnstatd [ OK ]
Setting up w3m (0.5.3-15) ...
Installing new version of config file /etc/w3m/config ...
Setting up whois (5.1.1) ...
Setting up wireless-regdb (2013.02.13-1ubuntu1) ...
Setting up wpasupplicant (2.1-0ubuntu1.1) ...
Setting up x11-apps (7.7+2) ...
Installing new version of config file /etc/X11/app-defaults/Xman ...
Installing new version of config file /etc/X11/app-defaults/XConsole ...
Installing new version of config file /etc/X11/app-defaults/XCalc ...
Setting up x11-session-utils (7.7+1) ...
Setting up x11-utils (7.7+1) ...
Installing new version of config file /etc/X11/app-defaults/Xfd ...
Installing new version of config file /etc/X11/app-defaults/Editres-color ...
Installing new version of config file /etc/X11/app-defaults/Editres ...
Setting up x11-xfs-utils (7.7+1) ...
Setting up x11-xserver-utils (7.7+2ubuntu1) ...
Setting up xbitmaps (1.1.1-2) ...
Setting up xfonts-utils (1:7.7+1) ...
Setting up xinput (1.6.1-1) ...
Setting up xserver-xorg-video-all (1:7.7+1ubuntu8.1) ...
Setting up xserver-xorg-input-all (1:7.7+1ubuntu8.1) ...
Setting up xserver-xorg (1:7.7+1ubuntu8.1) ...
Setting up xorg-docs-core (1:1.7-1) ...
Setting up xterm (297-1ubuntu1) ...
Installing new version of config file /etc/X11/app-defaults/XTerm ...
Setting up xorg (1:7.7+1ubuntu8.1) ...
Setting up libldns1 (1.6.17-1) ...
Setting up libmilter1.0.1 (8.14.4-4.1ubuntu1) ...
Setting up libopendkim9 (2.9.1-1) ...
Setting up librbl1 (2.9.1-1) ...
Setting up libvbr2 (2.9.1-1) ...
Setting up opendkim-tools (2.9.1-1) ...
Setting up opendkim (2.9.1-1) ...
Configuration file '/etc/opendkim.conf'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** opendkim.conf (Y/I/N/O/D/Z) [default=N] ?
Starting OpenDKIM: opendkim.
Setting up ssh-import-id (3.21-0ubuntu1) ...
Installing new version of config file /etc/ssh/ssh_import_id ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up postfix-pcre (2.11.0-1ubuntu1) ...
Setting up bsd-mailx (8.1.2-0.20131005cvs-1ubuntu0.14.04.1) ...
Processing triggers for dictionaries-common (1.20.5) ...
aspell-autobuildhash: processing: en [en-common]
aspell-autobuildhash: processing: en [en-variant_0]
aspell-autobuildhash: processing: en [en-variant_1]
aspell-autobuildhash: processing: en [en-variant_2]
aspell-autobuildhash: processing: en [en-w_accents-only]
aspell-autobuildhash: processing: en [en-wo_accents-only]
aspell-autobuildhash: processing: en [en_CA-variant_0]
aspell-autobuildhash: processing: en [en_CA-variant_1]
aspell-autobuildhash: processing: en [en_CA-w_accents-only]
aspell-autobuildhash: processing: en [en_CA-wo_accents-only]
aspell-autobuildhash: processing: en [en_GB-ise-w_accents-only]
aspell-autobuildhash: processing: en [en_GB-ise-wo_accents-only]
aspell-autobuildhash: processing: en [en_GB-ize-w_accents-only]
aspell-autobuildhash: processing: en [en_GB-ize-wo_accents-only]
aspell-autobuildhash: processing: en [en_GB-variant_0]
aspell-autobuildhash: processing: en [en_GB-variant_1]
aspell-autobuildhash: processing: en [en_US-w_accents-only]
aspell-autobuildhash: processing: en [en_US-wo_accents-only]
Setting up aspell (0.60.7~20110707-1ubuntu1) ...
Setting up hunspell-en-us (20070829-4ubuntu3) ...
Setting up libenchant1c2a:amd64 (1.6.0-10ubuntu1) ...
Setting up libwebkitgtk-3.0-0:amd64 (2.4.8-1ubuntu1~ubuntu14.04.1) ...
Setting up enchant (1.6.0-10ubuntu1) ...
Setting up gir1.2-webkit-3.0 (2.4.8-1ubuntu1~ubuntu14.04.1) ...
Processing triggers for dictionaries-common (1.20.5) ...
Setting up aspell-en (7.1-0-1) ...
Processing triggers for dictionaries-common (1.20.5) ...
Setting up humanity-icon-theme (0.6.5) ...
Setting up gnome-icon-theme (3.10.0-0ubuntu2) ...
Setting up gnome-icon-theme-symbolic (3.10.1-1ubuntu1) ...
Setting up libdevmapper1.02.1:amd64 (2:1.02.77-6ubuntu2) ...
Setting up libdevmapper-event1.02.1:amd64 (2:1.02.77-6ubuntu2) ...
Setting up perl-modules (5.18.2-2ubuntu1) ...
Setting up console-setup (1.70ubuntu8) ...
Installing new version of config file /etc/console-setup/compose.ISO-8859-13.inc ...
Installing new version of config file /etc/console-setup/compose.ISO-8859-1.inc ...
Installing new version of config file /etc/console-setup/compose.ISO-8859-4.inc ...
Installing new version of config file /etc/console-setup/compose.ISO-8859-3.inc ...
Installing new version of config file /etc/console-setup/compose.ISO-8859-7.inc ...
Installing new version of config file /etc/console-setup/compose.ISO-8859-2.inc ...
Installing new version of config file /etc/console-setup/compose.ISO-8859-9.inc ...
Installing new version of config file /etc/console-setup/compose.ISO-8859-14.inc ...
Installing new version of config file /etc/console-setup/compose.ISO-8859-15.inc ...
update-initramfs: deferring update (trigger activated)
Setting up kbd (1.15.5-1ubuntu1) ...
Setting up python3 (3.4.0-0ubuntu2) ...
running python rtupdate hooks for python3.4...
running python post-rtupdate hooks for python3.4...
Setting up dh-python (1.20140128-1ubuntu8) ...
Setting up python3-gdbm:amd64 (3.4.0-0ubuntu1) ...
Setting up python3-gi (3.12.0-1ubuntu1) ...
Setting up python3-apt (0.9.3.5ubuntu1) ...
Setting up python3-dbus (1.2.0-2build2) ...
Setting up language-selector-common (0.129.3) ...
Installing new version of config file /etc/fonts/conf.avail/30-cjk-aliases.conf ...
Installing new version of config file /etc/fonts/conf.avail/99-language-selector-zh.conf ...
Installing new version of config file /etc/fonts/conf.avail/69-language-selector-zh-sg.conf ...
Installing new version of config file /etc/fonts/conf.avail/69-language-selector-zh-tw.conf ...
Installing new version of config file /etc/fonts/conf.avail/69-language-selector-zh-mo.conf ...
Installing new version of config file /etc/fonts/conf.avail/69-language-selector-zh-hk.conf ...
Installing new version of config file /etc/fonts/conf.avail/69-language-selector-zh-cn.conf ...
Removing obsolete conffile /etc/fonts/conf.avail/69-language-selector-ja-jp.conf ...
Setting up libparted0debian1:amd64 (2.3-19ubuntu1) ...
Setting up language-pack-en (1:14.04+20150219) ...
Setting up language-pack-en-base (1:14.04+20150219) ...
Generating locales...
en_AG.UTF-8... up-to-date
en_AU.UTF-8... up-to-date
en_BW.UTF-8... up-to-date
en_CA.UTF-8... up-to-date
en_DK.UTF-8... up-to-date
en_GB.UTF-8... up-to-date
en_HK.UTF-8... up-to-date
en_IE.UTF-8... up-to-date
en_IN.UTF-8... up-to-date
en_NG.UTF-8... up-to-date
en_NZ.UTF-8... up-to-date
en_PH.UTF-8... up-to-date
en_SG.UTF-8... up-to-date
en_US.UTF-8... up-to-date
en_ZA.UTF-8... up-to-date
en_ZM.UTF-8... up-to-date
en_ZW.UTF-8... up-to-date
Generation complete.
Setting up tasksel-data (2.88ubuntu15) ...
Setting up tasksel (2.88ubuntu15) ...
Setting up update-notifier-common (0.154.1ubuntu1) ...
Setting up eject (2.1.5+deb1+cvs20081104-13.1) ...
Setting up lsb-release (4.1+Debian11ubuntu6) ...
Setting up apparmor (2.8.95~2430-0ubuntu5.1) ...
Installing new version of config file /etc/apparmor.d/tunables/global ...
Installing new version of config file /etc/apparmor.d/abstractions/private-files ...
Installing new version of config file /etc/apparmor.d/abstractions/p11-kit ...
Installing new version of config file /etc/apparmor.d/abstractions/dbus-session ...
Installing new version of config file /etc/apparmor.d/abstractions/cups-client ...
Installing new version of config file /etc/apparmor.d/abstractions/web-data ...
Installing new version of config file /etc/apparmor.d/abstractions/private-files-strict ...
Installing new version of config file /etc/apparmor.d/abstractions/audio ...
Installing new version of config file /etc/apparmor.d/abstractions/gnupg ...
Installing new version of config file /etc/apparmor.d/abstractions/ubuntu-helpers ...
Installing new version of config file /etc/apparmor.d/abstractions/samba ...
Installing new version of config file /etc/apparmor.d/abstractions/ubuntu-konsole ...
Installing new version of config file /etc/apparmor.d/abstractions/openssl ...
Installing new version of config file /etc/apparmor.d/abstractions/dbus ...
Installing new version of config file /etc/apparmor.d/abstractions/mysql ...
Installing new version of config file /etc/apparmor.d/abstractions/base ...
Installing new version of config file /etc/apparmor.d/abstractions/kde ...
Installing new version of config file /etc/apparmor.d/abstractions/bash ...
Installing new version of config file /etc/apparmor.d/abstractions/kerberosclient ...
Installing new version of config file /etc/apparmor.d/abstractions/ssl_certs ...
Installing new version of config file /etc/apparmor.d/abstractions/X ...
Installing new version of config file /etc/apparmor.d/abstractions/nvidia ...
Installing new version of config file /etc/apparmor.d/abstractions/fonts ...
Installing new version of config file /etc/apparmor.d/abstractions/nameservice ...
Installing new version of config file /etc/apparmor.d/abstractions/user-download ...
Installing new version of config file /etc/apparmor.d/abstractions/winbind ...
Installing new version of config file /etc/apparmor.d/abstractions/freedesktop.org ...
Installing new version of config file /etc/apparmor.d/abstractions/apache2-common ...
Installing new version of config file /etc/apparmor.d/abstractions/user-write ...
Installing new version of config file /etc/apparmor.d/abstractions/python ...
Installing new version of config file /etc/apparmor.d/abstractions/gnome ...
Installing new version of config file /etc/apparmor.d/abstractions/ubuntu-browsers.d/multimedia ...
Installing new version of config file /etc/apparmor.d/abstractions/ubuntu-browsers.d/ubuntu-integration ...
Installing new version of config file /etc/apparmor.d/abstractions/ubuntu-browsers.d/java ...
Installing new version of config file /etc/apparmor.d/abstractions/ubuntu-browsers.d/plugins-common ...
Installing new version of config file /etc/apparmor.d/abstractions/ubuntu-browsers.d/user-files ...
Installing new version of config file /etc/apparmor.d/abstractions/ruby ...
* Starting AppArmor profiles Warning from profile /sbin/dhclient (/etc/apparmor.d/sbin.dhclient) ptrace rules not enforced
Warning from profile /sbin/dhclient (/etc/apparmor.d/sbin.dhclient) signal rules not enforced
Warning from profile /usr/lib/NetworkManager/nm-dhcp-client.action (/etc/apparmor.d/sbin.dhclient) ptrace rules not enforced
Warning from profile /usr/lib/NetworkManager/nm-dhcp-client.action (/etc/apparmor.d/sbin.dhclient) signal rules not enforced
Warning from profile /usr/lib/NetworkManager/nm-dhcp-client.action (/etc/apparmor.d/sbin.dhclient) dbus rules not enforced
Warning from profile /usr/lib/connman/scripts/dhclient-script (/etc/apparmor.d/sbin.dhclient) ptrace rules not enforced
Warning from profile /usr/lib/connman/scripts/dhclient-script (/etc/apparmor.d/sbin.dhclient) signal rules not enforced
Warning from profile /usr/lib/connman/scripts/dhclient-script (/etc/apparmor.d/sbin.dhclient) dbus rules not enforced
Warning from profile /usr/sbin/named (/etc/apparmor.d/usr.sbin.named) ptrace rules not enforced
Warning from profile /usr/sbin/named (/etc/apparmor.d/usr.sbin.named) signal rules not enforced
Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
Warning from profile /usr/sbin/tcpdump (/etc/apparmor.d/usr.sbin.tcpdump) ptrace rules not enforced
Warning from profile /usr/sbin/tcpdump (/etc/apparmor.d/usr.sbin.tcpdump) signal rules not enforced
[ OK ]
* Reloading AppArmor profiles Warning from profile /sbin/dhclient (/etc/apparmor.d/sbin.dhclient) ptrace rules not enforced
Warning from profile /sbin/dhclient (/etc/apparmor.d/sbin.dhclient) signal rules not enforced
Warning from profile /usr/lib/NetworkManager/nm-dhcp-client.action (/etc/apparmor.d/sbin.dhclient) ptrace rules not enforced
Warning from profile /usr/lib/NetworkManager/nm-dhcp-client.action (/etc/apparmor.d/sbin.dhclient) signal rules not enforced
Warning from profile /usr/lib/NetworkManager/nm-dhcp-client.action (/etc/apparmor.d/sbin.dhclient) dbus rules not enforced
Warning from profile /usr/lib/connman/scripts/dhclient-script (/etc/apparmor.d/sbin.dhclient) ptrace rules not enforced
Warning from profile /usr/lib/connman/scripts/dhclient-script (/etc/apparmor.d/sbin.dhclient) signal rules not enforced
Warning from profile /usr/lib/connman/scripts/dhclient-script (/etc/apparmor.d/sbin.dhclient) dbus rules not enforced
Warning from profile /usr/sbin/named (/etc/apparmor.d/usr.sbin.named) ptrace rules not enforced
Warning from profile /usr/sbin/named (/etc/apparmor.d/usr.sbin.named) signal rules not enforced
Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
Warning from profile /usr/sbin/tcpdump (/etc/apparmor.d/usr.sbin.tcpdump) ptrace rules not enforced
Warning from profile /usr/sbin/tcpdump (/etc/apparmor.d/usr.sbin.tcpdump) signal rules not enforced
[ OK ]
Setting up python3-commandnotfound (0.3ubuntu12) ...
Setting up command-not-found (0.3ubuntu12) ...
Setting up parted (2.3-19ubuntu1) ...
Setting up python3-distupgrade (1:0.220.7) ...
Setting up python3-update-manager (1:0.196.12) ...
Setting up ubuntu-release-upgrader-core (1:0.220.7) ...
Installing new version of config file /etc/update-manager/release-upgrades ...
Installing new version of config file /etc/update-motd.d/91-release-upgrade ...
Setting up update-manager-core (1:0.196.12) ...
Setting up ubuntu-standard (1.325) ...
Setting up ufw (0.34~rc-0ubuntu2) ...
Replacing config file /etc/ufw/before.rules with new version
Replacing config file /etc/ufw/before6.rules with new version
Setting up grub-common (2.02~beta2-9ubuntu1) ...
Installing new version of config file /etc/grub.d/20_linux_xen ...
Installing new version of config file /etc/grub.d/10_linux ...
Installing new version of config file /etc/grub.d/00_header ...
Installing new version of config file /etc/grub.d/05_debian_theme ...
Installing new version of config file /etc/grub.d/30_uefi-firmware ...
Installing new version of config file /etc/grub.d/30_os-prober ...
Installing new version of config file /etc/bash_completion.d/grub ...
Setting up grub2-common (2.02~beta2-9ubuntu1) ...
Setting up grub-pc-bin (2.02~beta2-9ubuntu1) ...
Setting up grub-pc (2.02~beta2-9ubuntu1) ...
Installing new version of config file /etc/kernel/postinst.d/zz-update-grub ...
Installing new version of config file /etc/kernel/postrm.d/zz-update-grub ...
Installing for i386-pc platform.
Installation finished. No error reported.
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-49-generic
Found initrd image: /boot/initrd.img-3.13.0-49-generic
Found linux image: /boot/vmlinuz-3.5.0-45-generic
Found initrd image: /boot/initrd.img-3.5.0-45-generic
Found linux image: /boot/vmlinuz-3.5.0-44-generic
Found initrd image: /boot/initrd.img-3.5.0-44-generic
Found linux image: /boot/vmlinuz-3.5.0-43-generic
Found initrd image: /boot/initrd.img-3.5.0-43-generic
Found linux image: /boot/vmlinuz-3.5.0-42-generic
Found initrd image: /boot/initrd.img-3.5.0-42-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
done
Setting up python3-problem-report (2.14.1-0ubuntu3.8) ...
Setting up python3-apport (2.14.1-0ubuntu3.8) ...
Setting up apport (2.14.1-0ubuntu3.8) ...
Installing new version of config file /etc/apport/crashdb.conf ...
Installing new version of config file /etc/cron.daily/apport ...
Installing new version of config file /etc/init/apport.conf ...
apport start/running
Setting up gufw (14.04.2-0ubuntu1.2) ...
Setting up landscape-common (14.12-0ubuntu0.14.04) ...
Setting up unattended-upgrades (0.82.1ubuntu2.2) ...
Installing new version of config file /etc/pm/sleep.d/10_unattended-upgrades-hibernate ...
Installing new version of config file /etc/apt/apt.conf.d/50unattended-upgrades ...
Installing new version of config file /etc/init.d/unattended-upgrades ...
Installing new version of config file /etc/logrotate.d/unattended-upgrades ...
Setting up dmsetup (2:1.02.77-6ubuntu2) ...
update-initramfs: deferring update (trigger activated)
Setting up lvm2 (2.02.98-6ubuntu2) ...
Installing new version of config file /etc/lvm/lvm.conf ...
update-initramfs: deferring update (trigger activated)
Setting up perl (5.18.2-2ubuntu1) ...
Setting up libsub-name-perl (0.05-1build4) ...
Setting up libalgorithm-diff-perl (1.19.02-3) ...
Setting up libalgorithm-diff-xs-perl (0.04-2build4) ...
Setting up libfile-fcntllock-perl (0.14-2build1) ...
Setting up init-system-helpers (1.14) ...
Setting up libarchive-extract-perl (0.70-1) ...
Setting up liblog-message-simple-perl (0.10-1) ...
Setting up libmodule-pluggable-perl (5.1-1) ...
Setting up libpod-latex-perl (0.61-1) ...
Setting up libterm-ui-perl (0.42-1) ...
Setting up libtext-soundex-perl (3.4-1build1) ...
Setting up rsyslog (7.4.4-1ubuntu2.5) ...
Installing new version of config file /etc/default/rsyslog ...
Installing new version of config file /etc/rsyslog.conf ...
Adding user `syslog' to group `adm' ...
Adding user syslog to group adm
Done.
Skipping profile in /etc/apparmor.d/disable: usr.sbin.rsyslogd
rsyslog stop/waiting
rsyslog start/running, process 6950
Setting up openssh-server (1:6.6p1-2ubuntu2) ...
Installing new version of config file /etc/network/if-up.d/openssh-server ...
Installing new version of config file /etc/init/ssh.conf ...
Installing new version of config file /etc/init.d/ssh ...
Installing new version of config file /etc/pam.d/sshd ...
ssh stop/waiting
ssh start/running, process 7051
Setting up at (3.1.14-1ubuntu1) ...
Installing new version of config file /etc/pam.d/atd ...
atd start/running, process 7090
Setting up bind9 (1:9.9.5.dfsg-3ubuntu0.2) ...
Installing new version of config file /etc/bind/bind.keys ...
Installing new version of config file /etc/bind/db.root ...
Installing new version of config file /etc/init.d/bind9 ...
Installing new version of config file /etc/apparmor.d/usr.sbin.named ...
#
Warning from profile /usr/sbin/named (/etc/apparmor.d/usr.sbin.named) ptrace rules not enforced
Warning from profile /usr/sbin/named (/etc/apparmor.d/usr.sbin.named) signal rules not enforced
* Stopping domain name service... bind9 waiting for pid 1071 to die
[ OK ]
* Starting domain name service... bind9 [ OK ]
Setting up libtimedate-perl (2.3000-1) ...
Setting up libdpkg-perl (1.17.5ubuntu5.3) ...
Setting up dpkg-dev (1.17.5ubuntu5.3) ...
Setting up build-essential (11.6ubuntu6) ...
Setting up debhelper (9.20131227ubuntu1) ...
Setting up libio-string-perl (1.08-3) ...
Setting up libsys-hostname-long-perl (1.4-3) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up ubuntu-minimal (1.325) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...
Processing triggers for initramfs-tools (0.103ubuntu4.2) ...
update-initramfs: Generating /boot/initrd.img-3.13.0-49-generic
Processing triggers for libgdk-pixbuf2.0-0:amd64 (2.30.7-0ubuntu1) ...
Processing triggers for ca-certificates (20141019ubuntu0.14.04.1) ...
Updating certificates in /etc/ssl/certs... 35 added, 13 removed; done.
Running hooks in /etc/ca-certificates/update.d....done.
Processing triggers for sgml-base (1.26+nmu4ubuntu1) ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment