History log of /freebsd-13.1/lib/libc/string/strlen.c (Results 1 – 15 of 15)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/12.4.0, release/13.1.0, release/12.3.0, release/13.0.0
# 8a680912 03-Feb-2021 Mateusz Guzik <[email protected]>

Revert "Reimplement strlen"

This reverts commit 710e45c4b8539d028877769f1a4ec088c48fb5f1.

It breaks for some corner cases on big endian ppc64.
Given the stage of the release process it is best to r

Revert "Reimplement strlen"

This reverts commit 710e45c4b8539d028877769f1a4ec088c48fb5f1.

It breaks for some corner cases on big endian ppc64.
Given the stage of the release process it is best to revert for now.

Reported by: jhibbits

(cherry picked from commit 33f0540b13d949c7cc226a79927ddc2062ff98bf)

show more ...


# e5b67459 29-Jan-2021 Mateusz Guzik <[email protected]>

Reimplement strlen

The previous code neglected to use primitives which can find the end
of the string without having to branch on every character.

While here augment the somewhat misleading comment

Reimplement strlen

The previous code neglected to use primitives which can find the end
of the string without having to branch on every character.

While here augment the somewhat misleading commentary -- strlen as
implemented here leaves performance on the table, especially so for
userspace. Every arch should get a dedicated variant instead.

In the meantime this commit lessens the problem.

Tested with glibc test suite.

Naive test just calling strlen in a loop on Haswell (ops/s):

$(perl -e "print 'A' x 3"):
before: 211198039
after: 338626619

$(perl -e "print 'A' x 100"):
before: 83151997
after: 98285919

(cherry picked from commit 710e45c4b8539d028877769f1a4ec088c48fb5f1)

show more ...


Revision tags: release/12.2.0, release/11.4.0, release/12.1.0, release/11.3.0, release/12.0.0, release/11.2.0
# b6f7731d 10-May-2018 Xin LI <[email protected]>

Remove "All rights reserved" from my files.

See r333391 for the rationale.

MFC after: 1 week


# d915a14e 25-Nov-2017 Pedro F. Giffuni <[email protected]>

libc: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
p

libc: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

show more ...


Revision tags: release/10.4.0, release/11.1.0, release/11.0.1, release/11.0.0, release/10.3.0, release/10.2.0, release/10.1.0, release/9.3.0, release/10.0.0, release/9.2.0, release/8.4.0, release/9.1.0, release/8.3.0_cvs, release/8.3.0, release/9.0.0, release/7.4.0_cvs, release/8.2.0_cvs, release/7.4.0, release/8.2.0, release/8.1.0_cvs, release/8.1.0
# 42ddb8f1 13-May-2010 Xin LI <[email protected]>

MFC r205099-205100,205108:

Two optimizations to MI strlen(3) inspired by David S. Miller's
blog posting [1].

- Use word-sized test for unaligned pointer before working
the hard way.

Memory

MFC r205099-205100,205108:

Two optimizations to MI strlen(3) inspired by David S. Miller's
blog posting [1].

- Use word-sized test for unaligned pointer before working
the hard way.

Memory page boundary is always integral multiple of a word
alignment boundary. Therefore, if we can access memory
referenced by pointer p, then (p & ~word mask) must be also
accessible.

- Better utilization of multi-issue processor's ability of
concurrency.

The previous implementation utilized a formular that must be
executed sequentially. However, the ~, & and - operations can
actually be caculated at the same time when the operand were
different and unrelated.

The original Hacker's Delight formular also offered consistent
performance regardless whether the input would contain
characters with their highest-bit set, as it catches real
nul characters only.

These two optimizations has shown further improvements over the
previous implementation on microbenchmarks on i386 and amd64 CPU
including Pentium 4, Core Duo 2 and i7.

[1] http://vger.kernel.org/~davem/cgi-bin/blog.cgi/2010/03/08#strlen_1

show more ...


Revision tags: release/7.3.0_cvs, release/7.3.0
# 87c88b26 13-Mar-2010 Xin LI <[email protected]>

Correct bugs fixed but not merged from my own tree.

Pointy hat to: delphij
MFC after: 1 month


# 51e48ff2 12-Mar-2010 Xin LI <[email protected]>

Follow up commit to reindent the code.

MFC after: 1 month


# dabae226 12-Mar-2010 Xin LI <[email protected]>

Two optimizations to MI strlen(3) inspired by David S. Miller's
blog posting [1].

- Use word-sized test for unaligned pointer before working
the hard way.

Memory page boundary is always inte

Two optimizations to MI strlen(3) inspired by David S. Miller's
blog posting [1].

- Use word-sized test for unaligned pointer before working
the hard way.

Memory page boundary is always integral multiple of a word
alignment boundary. Therefore, if we can access memory
referenced by pointer p, then (p & ~word mask) must be also
accessible.

- Better utilization of multi-issue processor's ability of
concurrency.

The previous implementation utilized a formular that must be
executed sequentially. However, the ~, & and - operations can
actually be caculated at the same time when the operand were
different and unrelated.

The original Hacker's Delight formular also offered consistent
performance regardless whether the input would contain
characters with their highest-bit set, as it catches real
nul characters only.

These two optimizations has shown further improvements over the
previous implementation on microbenchmarks on i386 and amd64 CPU
including Pentium 4, Core Duo 2 and i7.

[1] http://vger.kernel.org/~davem/cgi-bin/blog.cgi/2010/03/08#strlen_1

MFC after: 1 month

show more ...


Revision tags: release/8.0.0_cvs, release/8.0.0, release/7.2.0_cvs, release/7.2.0
# 481101b8 26-Jan-2009 Xin LI <[email protected]>

- Fix grammar. [1]
- Use the correct term 'long mode'. [2]
- style(9) for return value. [3]

Submitted by: Ben Kaduk <minimarmot gmail com> [1],
obrien [2], scf [3]


# 4c6a6021 25-Jan-2009 Xin LI <[email protected]>

Rewrite of MI strlen(3) in a way that can better utilize modern hardware by
reducing branches and doing word-sized operation.

The idea is taken from J.T. Conklin's x86_64 optimized version of strlen

Rewrite of MI strlen(3) in a way that can better utilize modern hardware by
reducing branches and doing word-sized operation.

The idea is taken from J.T. Conklin's x86_64 optimized version of strlen(3)
for NetBSD, and reimplemented in C by me.

Discussed on: -arch@

show more ...


Revision tags: release/7.1.0_cvs, release/7.1.0, release/6.4.0_cvs, release/6.4.0, release/7.0.0_cvs, release/7.0.0, release/6.3.0_cvs, release/6.3.0, release/6.2.0_cvs, release/6.2.0
# c879ae35 09-Jan-2007 Warner Losh <[email protected]>

Per Regents of the University of Calfornia letter, remove advertising
clause.

# If I've done so improperly on a file, please let me know.


Revision tags: release/5.5.0_cvs, release/5.5.0, release/6.1.0_cvs, release/6.1.0, release/6.0.0_cvs, release/6.0.0, release/5.4.0_cvs, release/5.4.0, release/4.11.0_cvs, release/4.11.0, release/5.3.0_cvs, release/5.3.0, release/4.10.0_cvs, release/4.10.0, release/5.2.1_cvs, release/5.2.1, release/5.2.0_cvs, release/5.2.0, release/4.9.0_cvs, release/4.9.0, release/5.1.0_cvs, release/5.1.0, release/4.8.0_cvs, release/4.8.0, release/5.0.0_cvs, release/5.0.0, release/4.7.0_cvs, release/4.6.2_cvs, release/4.6.2, release/4.6.1, release/4.6.0_cvs
# 8fb3f3f6 21-Mar-2002 David E. O'Brien <[email protected]>

Remove 'register' keyword.


Revision tags: release/4.5.0_cvs, release/4.4.0_cvs
# de5fe5d5 07-Nov-2001 David E. O'Brien <[email protected]>

rcsid[]->__FBSDID


# 5864b79c 24-May-2001 David E. O'Brien <[email protected]>

Make the rcsid and FreeBSD IDs more sane in the wcs* and wmem* files.
Do the same for the non-wcs*/wmem* files while I'm here.


Revision tags: release/4.3.0_cvs, release/4.3.0, release/4.2.0, release/4.1.1_cvs, release/4.1.0, release/3.5.0_cvs, release/4.0.0_cvs, release/3.4.0_cvs, release/3.3.0_cvs, release/3.2.0, release/3.1.0, release/3.0.0, release/2.2.8, release/2.2.7, release/2.2.6, release/2.2.5_cvs, release/2.2.2_cvs, release/2.2.1_cvs, release/2.2.0, release/2.1.7_cvs, release/2.1.6_cvs, release/2.1.6.1, release/2.1.5_cvs, release/2.1.0_cvs, release/2.0.5_cvs, release/2.0, release/1.1.5.1_cvs
# 58f0484f 27-May-1994 Rodney W. Grimes <[email protected]>

BSD 4.4 Lite Lib Sources