Files
wuffs/cmd/puffs-c/internal/cgen/noph.go
T
Nigel Tao ed6ce6fd54 Add PUFFS_USE_NO_OP_PERFORMANCE_HACKS.
name                             old speed      new speed      delta

puffs_adler32_10k/gcc            3.26GB/s ± 0%  3.26GB/s ± 0%     ~     (p=0.222 n=5+5)
puffs_adler32_100k/gcc           3.27GB/s ± 0%  3.27GB/s ± 0%   -0.12%  (p=0.032 n=5+5)
puffs_flate_decode_1k/gcc         108MB/s ± 0%   108MB/s ± 0%     ~     (p=0.841 n=5+5)
puffs_flate_decode_10k/gcc        128MB/s ± 0%   128MB/s ± 0%     ~     (p=0.057 n=4+4)
puffs_flate_decode_100k/gcc       136MB/s ± 0%   136MB/s ± 0%     ~     (p=0.222 n=5+5)
puffs_zlib_decode_10k/gcc         123MB/s ± 0%   123MB/s ± 0%     ~     (p=0.730 n=5+4)
puffs_zlib_decode_100k/gcc        130MB/s ± 0%   131MB/s ± 0%     ~     (p=1.000 n=5+5)

puffs_gif_lzw_decode_20k/gcc      137MB/s ± 4%   140MB/s ± 3%     ~     (p=0.095 n=5+5)
puffs_gif_lzw_decode_100k/gcc     177MB/s ± 3%   187MB/s ± 2%   +5.75%  (p=0.008 n=5+5)
puffs_gif_decode_1k/gcc           348MB/s ± 0%   401MB/s ± 1%  +15.34%  (p=0.016 n=4+5)
puffs_gif_decode_10k/gcc          121MB/s ± 5%   154MB/s ± 1%  +27.90%  (p=0.008 n=5+5)
puffs_gif_decode_100k/gcc         106MB/s ± 4%   131MB/s ± 2%  +24.35%  (p=0.008 n=5+5)
puffs_gif_decode_1000k/gcc        109MB/s ± 2%   135MB/s ± 1%  +24.03%  (p=0.008 n=5+5)
2017-11-02 14:51:29 +11:00

63 lines
1.9 KiB
Go

// Copyright 2017 The Puffs Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cgen
// This file hard-codes PUFFS_USE_NO_OP_PERFORMANCE_HACKS code fragments that
// look like redundant no-ops, but for reasons to be investigated, can have
// dramatic performance effects with gcc 4.8.4 (e.g. 1.2x on some benchmarks).
//
// TODO: investigate; delete these hacks (without regressing performance).
type nophKey struct {
gCurrFunkCName string
genMethod string
headerFooter bool
}
var noOpPerformanceHacks = map[nophKey]string{
{
gCurrFunkCName: "puffs_gif__decoder__decode_id",
genMethod: "writeSaveDerivedVar",
headerFooter: false,
}: `
#ifdef PUFFS_USE_NO_OP_PERFORMANCE_HACKS
if (a_src.private_impl.no_op_performance_hacks) {
puffs_base__paired_nulls* pn =
a_src.private_impl.no_op_performance_hacks->noph0;
while (pn && pn->always_null0) {
*((int*)(pn->always_null0)) = 0;
pn = (puffs_base__paired_nulls*)(pn->always_null1);
}
}
#endif
`,
{
gCurrFunkCName: "puffs_gif__lzw_decoder__decode",
genMethod: "writeLoadDerivedVar",
headerFooter: true,
}: `
#ifdef PUFFS_USE_NO_OP_PERFORMANCE_HACKS
if (a_src.private_impl.no_op_performance_hacks) {
if (a_src.private_impl.no_op_performance_hacks->noph1 &&
(len > a_src.private_impl.no_op_performance_hacks->noph1)) {
len = a_src.private_impl.no_op_performance_hacks->noph1;
}
}
#endif
`,
}
// puffs_gif__decoder__decode_id