mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 22:02:27 +00:00
Mold the redbean binary to minimize page faults
This change brings page faults for precompressed static asset serving down from 27 to 20 (or fewer) after fork. This is more of an art than science. Hopefully Blinkenlights can visualize page faults soon.
This commit is contained in:
parent
2d34819779
commit
e56a9d0e23
14 changed files with 978 additions and 782 deletions
|
@ -16,7 +16,6 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/safemacros.internal.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
/**
|
||||
|
@ -30,8 +29,13 @@
|
|||
*/
|
||||
char *strstr(const char *haystack, const char *needle) {
|
||||
size_t i;
|
||||
if (!*needle) return haystack;
|
||||
haystack = firstnonnull(strchr(haystack, *needle), haystack);
|
||||
const char *p;
|
||||
if (!needle[0]) return haystack;
|
||||
if (haystack == needle) return haystack;
|
||||
p = strchr(haystack, needle[0]);
|
||||
if (!needle[1]) return p;
|
||||
if (p) haystack = p;
|
||||
/* TODO: make not quadratic */
|
||||
for (;;) {
|
||||
for (i = 0;;) {
|
||||
if (!needle[i]) return (/*unconst*/ char *)haystack;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue