Skip to content

Instantly share code, notes, and snippets.

@laino
laino / 0001-ntdll-improve-heap-allocation-performance.patch
Created August 21, 2016 22:59
ntdll: improve heap allocation performance
From 8096bf027cd548e899ec49e5b85e1511ce3463be Mon Sep 17 00:00:00 2001
From: Nils Kuhnhenn <kuhnhenn.nils@gmail.com>
Date: Fri, 19 Aug 2016 11:01:30 +0200
Subject: [PATCH] ntdll: improve heap allocation performance
- Automatically balancing free lists: It is impossible
to tune free list sizes (manually) for every application, since
every application has different allocation patterns/sizes.
Some applications end up having over 10000 elements
in one free list, destroying performance and oftentimes
From 3c1bd9b2b9ac59c8a1ad8928d90ee69c47337519 Mon Sep 17 00:00:00 2001
From: Nils Kuhnhenn <kuhnhenn.nils@gmail.com>
Date: Fri, 19 Aug 2016 11:01:30 +0200
Subject: [PATCH] ntdll: drastically improve heap allocation performance.
- Automatically balancing free lists.
- Added a fast case to skip to the next free list when the
current list doesn't contain any large-enough block.
Signed-off-by: Nils Kuhnhenn <kuhnhenn.nils@gmail.com>
From 159cf9f45d986ab7b8a1dd9c96d28755358e7528 Mon Sep 17 00:00:00 2001
From: Nils Kuhnhenn <kuhnhenn.nils@gmail.com>
Date: Fri, 19 Aug 2016 11:01:30 +0200
Subject: [PATCH] ntdll: drastically improve heap allocation performance.
- Automatically balancing free lists.
- Added a fast case to skip to the next free list when the
current list doesn't contain any large-enough block.
Signed-off-by: Nils Kuhnhenn <kuhnhenn.nils@gmail.com>
From a87eae71e37b967afb2ee58bcab342f4cbffa8f5 Mon Sep 17 00:00:00 2001
From: Nils Kuhnhenn <kuhnhenn.nils@gmail.com>
Date: Sat, 6 Aug 2016 16:25:27 +0200
Subject: [PATCH] wined3d: use SwitchToThread() and calls to select() in
busy-loops
---
dlls/wined3d/cs.c | 39 +++++++++++++++++++++++++++++++--------
dlls/wined3d/wined3d_private.h | 42 ++++++++++++++++++++++++++++++++++++++++--
2 files changed, 71 insertions(+), 10 deletions(-)
From 5e89ce2476b3e516c19afc58b1b14a156acd2f43 Mon Sep 17 00:00:00 2001
From: Nils Kuhnhenn <kuhnhenn.nils@gmail.com>
Date: Sat, 6 Aug 2016 16:25:27 +0200
Subject: [PATCH] wined3d: use SwitchToThread() and calls to select() in
busy-loops
---
dlls/wined3d/cs.c | 39 +++++++++++++++++++++++++++++++--------
dlls/wined3d/wined3d_private.h | 42 ++++++++++++++++++++++++++++++++++++++++--
2 files changed, 71 insertions(+), 10 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 505661d..a099c33 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -642,6 +642,8 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
unsigned int i;
#if defined(STAGING_CSMT)
LONG pending;
+ LARGE_INTEGER spin_start;
+ spin_start.QuadPart = 0;
@laino
laino / wined3d_csmt_fix_return.diff
Last active August 5, 2016 17:19
Wine CSMT patches
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 44d5f8a..c7c80c6 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2495,7 +2495,10 @@ static UINT wined3d_cs_exec_set_light(struct wined3d_cs *cs, const void *data)
TRACE("Adding new light\n");
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
- return E_OUTOFMEMORY;
+ {
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 7731a82..301e395 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -662,7 +662,10 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
* In Counter-Strike: Source a frame difference of 3 causes noticable
* input delay that makes the game unplayable. */
while (pending > 1)
+ {
+ wined3d_cs_mt_yield();
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 98cfa2e..3934469 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -661,7 +661,10 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
* In Counter-Strike: Source a frame difference of 3 causes noticable
* input delay that makes the game unplayable. */
while (pending > 1)
+ {
+ usleep(0);
@laino
laino / fstream_index.js
Created September 26, 2014 11:47
Faster streaming
'use strict';
var events = require('events');
var util = require('util');
var fs = require('fs');
var BUFF_SIZE = 32 * 1024;
var BUFF_MAX = 256 * 1024;
var BUFF_GROW = 32 * 1024;