<- read.csv('jmh.csv')
df $Benchmark <- gsub('^.*\\.', '', df$Benchmark, )
df$Benchmark <- gsub('queue:', '', df$Benchmark)
df$Benchmark <- gsub('queue', 'all', df$Benchmark)
df$Benchmark <- as.factor(df$Benchmark)
dfnames(df) <- gsub('spinningCounterpart', 'counterpart', names(df))
names(df) <- gsub('Param\\.\\.', '', names(df))
names(df) <- gsub('\\.\\.99\\.9.*', '', names(df))
names(df) <- gsub('Score', 'Throughput', names(df))
<- df[df$cooldownSleep=='true',!(names(df)%in%c('Mode', 'Threads', 'Samples', 'Unit'))]
df
$capacity <- as.factor(df$capacity)
df$cooldownSleep <-as.factor(df$cooldownSleep)
df$counterpart <-as.factor(ifelse(df$counterpart=='true', 'NOWAIT', 'WAIT'))
df$implementation <- factor(df$implementation, levels=c('LOCK', 'SPIN', 'PADDED_SPIN', 'SPSC', 'PADDED_SPSC'), ordered=F)
df$Throughput.lo <- df$Throughput - df$Throughput.Error
df$Throughput.hi <- df$Throughput + df$Throughput.Error
df df
Locking without false sharing
JMH plots
Load JMH data
<- df[df$capacity==1 & df$Benchmark%in%c('offer', 'poll') & df$counterpart=='WAIT',]
plot.df <- ggplot(plot.df, aes(x=Benchmark, y=Throughput, fill=implementation)) +
p geom_bar(stat='identity', position = 'dodge') +
geom_errorbar(aes(ymin=Throughput.lo, ymax=Throughput.hi), position='dodge') +
labs(y='ops/ms', fill='Implementation', title='Throughput on 1-slot queue, waiting counterpart')
ggsave('jmh-nowait-wait-unit.png', p)
Saving 7 x 5 in image
print(p)
<- df[df$capacity==1 & df$Benchmark%in%c('offer', 'poll') & df$counterpart=='NOWAIT',]
plot.df <- ggplot(plot.df, aes(x=Benchmark, y=Throughput, fill=implementation)) +
p geom_bar(stat='identity', position = 'dodge') +
geom_errorbar(aes(ymin=Throughput.lo, ymax=Throughput.hi), position='dodge') +
labs(y='ops/ms', fill='Implementation', title='Throughput on 1-slot queue, non-waiting counterpart')
ggsave('jmh-nowait-nowait-unit.png', p)
Saving 7 x 5 in image
print(p)
<- df
dfLog $Throughput.text <- sprintf('%.2f', dfLog$Throughput)
dfLog$Throughput <- log10(dfLog$Throughput)
dfLog$Throughput.lo <- log10(dfLog$Throughput.lo) dfLog
Warning: NaNs produced
$Throughput.hi <- log10(dfLog$Throughput.hi)
dfLog<-dfLog[dfLog$capacity==1 & dfLog$Benchmark%in%c('put', 'take') & dfLog$counterpart == 'WAIT',]
plot.df <- ggplot(plot.df, aes(x=Benchmark, y=Throughput, fill=implementation)) +
p geom_bar(stat='identity', position = 'dodge') +
geom_errorbar(aes(ymin=Throughput.lo, ymax=Throughput.hi), position='dodge') +
geom_label(aes(label=Throughput.text), position=position_dodge(width=.9), show.legend=F) +
labs(y='log10(ops/ms)', fill='Implementation', title='Throughput on 1-slot queue, waiting (take,put) counterpart')
ggsave('jmh-wait-wait-unit.png', p)
Saving 7 x 5 in image
print(p)
# dfLog <- df
# dfLog$Throughput.text <- sprintf('%.2f', dfLog$Throughput)
# dfLog$Throughput <- log10(dfLog$Throughput)
# dfLog$Throughput.lo <- log10(dfLog$Throughput.lo)
# dfLog$Throughput.hi <- log10(dfLog$Throughput.hi)
# plot.df <-dfLog[dfLog$capacity==1 & dfLog$Benchmark%in%c('put', 'take') & dfLog$counterpart == 'NOWAIT',]
<- df[df$capacity==1 & df$Benchmark%in%c('put', 'take') & df$counterpart == 'NOWAIT',]
plot.df <- ggplot(plot.df, aes(x=Benchmark, y=Throughput, fill=implementation)) +
p geom_bar(stat='identity', position = 'dodge') +
geom_errorbar(aes(ymin=Throughput.lo, ymax=Throughput.hi), position='dodge') +
#geom_label(aes(label=Throughput.text), position=position_dodge(width=.9), show.legend=F) +
labs(y='log10(ops/ms)', fill='Implementation', title='Throughput on 1-slot queue')
ggsave('jmh-wait-nowait-unit.png', p)
Saving 7 x 5 in image
print(p)