Skip to content

Instantly share code, notes, and snippets.

View ice799's full-sized avatar

Joe Damato ice799

  • san francisco, ca
View GitHub Profile
#if 0
In these examples, let's assume that passing more than 2 args to the program is
*not* the case we are optimizing this for.
With that in mind, lets build a sample program with
and without __builtin_expect and compare assembly output.
#endif
/*
no predictor:
;
; branch predictor on with -O2
;
0000000000000000 <st_lookup>:
0: 48 89 5c 24 d8 mov %rbx,-0x28(%rsp)
5: 48 89 6c 24 e0 mov %rbp,-0x20(%rsp)
a: 48 89 fd mov %rdi,%rbp
d: 4c 89 64 24 e8 mov %r12,-0x18(%rsp)
[joe@sloth:/home/joe/code/small_malloc/bsdmalloc]% LD_PRELOAD=/home/joe/code/small_malloc/bsdmalloc/libbsdmalloc.so.1.0.1 /usr/bin/time ./a.out
22.42user 0.01system 0:22.48elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+138minor)pagefaults 0swaps
[joe@sloth:/home/joe/code/small_malloc/bsdmalloc]% LD_PRELOAD=/custom/lib/libtcmalloc_minimal.so.0.0.0 /usr/bin/time ./a.out
36.89user 0.02system 0:37.00elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+1530minor)pagefaults 0swaps
[joe@sloth:/home/joe/code/small_malloc/bsdmalloc]% /usr/bin/time ./a.out
commit 2ec0bd00031a777237a24b7cd6a06b0f7f007430
Author: Joe Damato <ice799@gmail.com>
Date: Wed Nov 18 16:22:06 2009 -0800
add malloc_usable_size
diff --git a/configure.ac b/configure.ac
index 9db399a..12cc585 100644
--- a/configure.ac
+++ b/configure.ac
@ice799
ice799 / wow.c
Created November 22, 2009 06:57
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
int rb_new_obj() {
printf("hi\n");
exit(1);
}
#define _GNU_SOURCE
#include <err.h>
#include <fcntl.h>
#include <gelf.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <link.h>
#include <sysexits.h>
irb(main):021:0> Time.now.zone
=> "UTC"
irb(main):022:0> Time.now.utc?
=> false
### and also:
irb(main):005:0> Time.now.iso8601
=> "2010-03-31T23:46:20+00:00"
James Damato • (973) 634-2031 • jdtwelv@yahoo.com
PROFESSIONAL EXPERIENCE
KPMG, Montvale, NJ 8/09 – Present
Research Associate – Global Risk Management
• Download Issuer and Securities data files daily, perform quality check to confirm file validity,
and post to local applications for data refresh
• Download Cognos reports weekly to assist with HR and Compliance Report creation process
• Perform data file retrieval tasks and execute programs to create daily identifier change reports
• Compile data from vendor web and place data files in established location for refresh of the
2010-05-11 Joe Damato <ice799@gmail.com>
* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve): Save and
restore SSE registers.
---
sysdeps/x86_64/dl-trampoline.S | 34 +++++++++++++++++++++++++++-------
1 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/sysdeps/x86_64/dl-trampoline.S b/sysdeps/x86_64/dl-trampoline.S
index 5564a11..44706d9 100644
_dl_runtime_resolve:
subq $56,%rsp
cfi_adjust_cfa_offset(72) # Incorporate PLT
movq %rax,(%rsp) # Preserve registers otherwise clobbered.
movq %rcx, 8(%rsp)
movq %rdx, 16(%rsp)
movq %rsi, 24(%rsp)
movq %rdi, 32(%rsp)
movq %r8, 40(%rsp)
movq %r9, 48(%rsp)