performance enhancements
This commit is contained in:
parent
063cb2f449
commit
7bd3719c72
13
Program.cs
13
Program.cs
@ -844,9 +844,9 @@ public class Game : GameWindow {
|
||||
// string[] files = Directory.GetFiles(@"c:\users\colin\desktop\photos-test\");
|
||||
// string[] files = Directory.GetFiles(@"c:\users\colin\pictures\photos\2023\07\14\");
|
||||
// string[] files = Directory.GetFiles(@"c:\users\colin\pictures\photos\2023\09\06\jpg");
|
||||
string[] files = Directory.GetFiles(@"G:\DCIM\100EOSR6\");
|
||||
// string[] files = Directory.GetFiles(@"G:\DCIM\100EOSR6\");
|
||||
// string[] files = Directory.GetFiles(@"c:\users\colin\desktop\totte-output\2023\08\03");
|
||||
// string[] files = Directory.GetFiles(@"c:\users\colin\desktop\export");
|
||||
string[] files = Directory.GetFiles(@"c:\users\colin\desktop\17\2-jpg");
|
||||
// string[] files = Directory.GetFiles(@"C:\Users\colin\Pictures\photos\2018\06\23");
|
||||
// string[] files = Directory.GetFiles(@"C:\Users\colin\Desktop\Germany all\104D7000");
|
||||
// string[] files = Directory.GetFiles(@"C:\Users\colin\Desktop\many-birds\");
|
||||
@ -897,7 +897,7 @@ public class Game : GameWindow {
|
||||
private void UnloadImages() {
|
||||
// Unload images that haven't been touched in a while.
|
||||
lock (loadedImagesLock) {
|
||||
while (loadedImages.Count > 30) {
|
||||
while (loadedImages.Count > 20) {
|
||||
long earliestTime = long.MaxValue;
|
||||
Photo? earliest = null;
|
||||
foreach (Photo photo in loadedImages) {
|
||||
@ -926,7 +926,7 @@ public class Game : GameWindow {
|
||||
}
|
||||
}
|
||||
// Start loading any images that are in our window but not yet loaded.
|
||||
int minLoadedImage = Math.Max(0, photoIndex - 10);
|
||||
int minLoadedImage = Math.Max(0, photoIndex - 5);
|
||||
int maxLoadedImage = Math.Min(photoIndex + 10, photos.Count - 1);
|
||||
List<Photo> toLoad = new();
|
||||
for (int i = minLoadedImage; i <= maxLoadedImage; i++) {
|
||||
@ -939,7 +939,8 @@ public class Game : GameWindow {
|
||||
}
|
||||
}
|
||||
foreach (Photo p in toLoad) {
|
||||
await Task.Run( () => { p.LoadAsync(p.Size); });
|
||||
// await Task.Run( () => { p.LoadAsync(p.Size); });
|
||||
await Task.Run( () => { p.LoadAsync(geometry.PhotoBox.Size); });
|
||||
}
|
||||
}
|
||||
|
||||
@ -947,7 +948,7 @@ public class Game : GameWindow {
|
||||
List<Task> tasks = new();
|
||||
foreach (Photo p in allPhotos) {
|
||||
tasks.Add(Task.Run( () => {
|
||||
p.LoadThumbnailAsync(new Vector2i(256, 256));
|
||||
p.LoadThumbnailAsync(new Vector2i(128, 128));
|
||||
lock (numThumbnailsLoadedLock) {
|
||||
numThumbnailsLoaded++;
|
||||
toast.Set($"[{numThumbnailsLoaded}/{allPhotos.Count}] Loading thumbnails");
|
||||
|
Loading…
Reference in New Issue
Block a user