Author Topic: 64 bit generic question  (Read 4579 times)

0 Members and 1 Guest are viewing this topic.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
64 bit generic question
« on: April 03, 2013, 03:47:40 PM »
So other than changing the platform target in my project properties, is there anything else that I should change to make things run faster?  Seems like my new computer should run light years faster than the old one.  It feels like I'm running 32bit code on 64bit machine.  I know this is open ended question, but I cant seem to find any other information relating to this.


BTW, the code is a Windows app, which searches a network drive for a drawing by name.  I can post the code if desired
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: 64 bit generic question
« Reply #1 on: April 03, 2013, 03:48:26 PM »
new machine specs - 16 gigs of ram Win 7
old machine 3gb XP
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: 64 bit generic question
« Reply #2 on: April 03, 2013, 03:52:48 PM »
If you changed *only* the OS and added RAM, there isn't any reason for the same code any faster.  If you changed the entire computer, there may be a modest increase in speed, depending on the differences.  The only real way to get things to run faster is process optimization - providing early exits from loops to avoid irrelevant operations, avoiding polling items/calculating values multiple times rather than doing it once and storing the result... yeah, code would help :)
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: 64 bit generic question
« Reply #3 on: April 03, 2013, 03:55:33 PM »
complete new machine, should have said that.

Code: [Select]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace TEPFindFile
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnCompletedFiles_Click(object sender, EventArgs e)
        {
            folderBrowserDialog1.RootFolder = Environment.SpecialFolder.MyComputer;
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                txtCompletedFiles.Text = folderBrowserDialog1.SelectedPath.ToString();
                folderBrowserDialog1.Reset();
            }
        }

        private void btnSearchFolder_Click(object sender, EventArgs e)
        {
            folderBrowserDialog1.RootFolder = Environment.SpecialFolder.MyComputer;
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                txtSearchFolder.Text = folderBrowserDialog1.SelectedPath.ToString();
                folderBrowserDialog1.Reset();
            }
        }
        private void btnFindDups_Click(object sender, EventArgs e)
        {
            string pathCFiles = txtCompletedFiles.Text;
            string[] arrCompletedDrawings = Directory.GetFiles(pathCFiles, "*.dwg");
            string dupeFile = pathCFiles + "\\" + "Dupes.txt";
            string pathLockedFiles = txtSearchFolder.Text;
            progressBar1.Visible = true;
            progressBar1.Minimum = 1;
            progressBar1.Maximum = 1 + arrCompletedDrawings.Count();
            progressBar1.Value = 1;
            foreach (string dwg in arrCompletedDrawings)
            {
                string filedwg = dwg.Substring(dwg.LastIndexOf("\\") + 1);
                LoadDirFiles(pathLockedFiles, true, filedwg, dupeFile, pathCFiles);
                progressBar1.Value += 1;
                Application.DoEvents();
            }
            progressBar1.Visible = false;
            MessageBox.Show("Completed Searching for Duplicates");
        }
        private void LoadDirFiles(string Dir, bool CheckSubs, string dwgTF, string dupFile, string origPath)
        {
            string[] fls = Directory.GetFiles(Dir);
            foreach (string fl in fls)
            {
                string path = fl.Substring(0, fl.LastIndexOf("\\"));
                string filedwg = fl.Substring(fl.LastIndexOf("\\") + 1);
                if (path.ToUpper() != origPath.ToUpper())
                {
                    if (dwgTF.ToUpper() == filedwg.ToUpper())
                    {
                        WriteDups(fl, dupFile);
                    }
                   
                }
            }
            if (CheckSubs)
            {
                string[] dirs = Directory.GetDirectories(Dir);
                foreach (string d in dirs)
                {
                    LoadDirFiles(d, CheckSubs, dwgTF, dupFile, origPath);
                }
            }
        }

        private void txtCompletedFiles_Click(object sender, EventArgs e)
        {
            txtCompletedFiles.Select(0, txtCompletedFiles.TextLength);
        }
        private void txtSearchFolder_Click(object sender, EventArgs e)
        {
            txtSearchFolder.Select(0, txtSearchFolder.TextLength);
        }
        static void WriteDups(string dupDWG, string dupFile)
        {
            StreamWriter sw = new StreamWriter(dupFile, true);
            sw.WriteLine(dupDWG);
            sw.Close();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
    static class FileHelper
    {
        public static List<string> GetFilesRecursive(string b)
        {
            // 1.
            // Store results in the file results list.
            List<string> result = new List<string>();

            // 2.
            // Store a stack of our directories.
            Stack<string> stack = new Stack<string>();

            // 3.
            // Add initial directory.
            stack.Push(b);

            // 4.
            // Continue while there are directories to process
            while (stack.Count > 0)
            {
                // A.
                // Get top directory
                string dir = stack.Pop();

                try
                {
                    // B
                    // Add all files at this directory to the result List.
                    result.AddRange(Directory.GetFiles(dir, "*.*"));

                    // C
                    // Add all directories at this directory.
                    foreach (string dn in Directory.GetDirectories(dir))
                    {
                        stack.Push(dn);
                    }
                }
                catch
                {
                    // D
                    // Could not open the directory
                }
            }
            return result;
        }

    }
}
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: 64 bit generic question
« Reply #4 on: April 03, 2013, 03:55:52 PM »
I can post the project zipped if that would help
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: 64 bit generic question
« Reply #5 on: April 03, 2013, 04:02:21 PM »
It could be that it is just slow.  I have noticed that searching with Win 7 is different than XP, and maybe I'm not using indexed searches in my code (grasping for straws, as I dont know if that is even possible)
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: 64 bit generic question
« Reply #6 on: April 03, 2013, 04:02:43 PM »
But it seems slower than it did on XP
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Jeff H

  • Needs a day job
  • Posts: 6150
Re: 64 bit generic question
« Reply #7 on: April 03, 2013, 04:55:04 PM »
I think it would be hard to compare when trying to get resources from a network drive since so much depends on the network and other factors out of your control.
Your new machine should create the "Go get it boy" message faster, but it would be so minute compared to time for network to return it.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: 64 bit generic question
« Reply #8 on: April 03, 2013, 05:07:09 PM »
I was afraid of that.  As we keep filling the drive, the program runs slower just because it has more to search through
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: 64 bit generic question
« Reply #9 on: April 03, 2013, 06:02:31 PM »
So other than changing the platform target in my project properties, is there anything else that I should change to make things run faster?  Seems like my new computer should run light years faster than the old one.  It feels like I'm running 32bit code on 64bit machine.  I know this is open ended question, but I cant seem to find any other information relating to this.


BTW, the code is a Windows app, which searches a network drive for a drawing by name.  I can post the code if desired

If the app is VBA then you are going to see performance problems. 64 bit AutoCAD goes through a thunk to run VBA and it's very slow.
Of course you now have the option of 64 bit VBA (ver 7.1) in AutoCAD 2014. Just installed it. I'm hoping for the kind of performance improvement you describe.

It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: 64 bit generic question
« Reply #10 on: April 03, 2013, 06:03:05 PM »
Is there a way to just look over the file tables at the beginning of the drive instead of the files inside?
They discuss it here

TheMaster

  • Guest
Re: 64 bit generic question
« Reply #11 on: April 03, 2013, 07:58:50 PM »
So other than changing the platform target in my project properties, is there anything else that I should change to make things run faster?  Seems like my new computer should run light years faster than the old one.  It feels like I'm running 32bit code on 64bit machine.  I know this is open ended question, but I cant seem to find any other information relating to this.


BTW, the code is a Windows app, which searches a network drive for a drawing by name.  I can post the code if desired

I wouldn't expect to see any better performance with an app like what you describe, unless you upgraded your network or your servers or whatever systems contain the data being searched.

Apps that spend most of their time searching a network will not see much benefit from running on a faster system, as they are generally bound by network bandwidth.

Bryco

  • Water Moccasin
  • Posts: 1883
Re: 64 bit generic question
« Reply #12 on: April 03, 2013, 08:28:30 PM »
As a note, when you are debugging 64 bit is way slower than 32 bit. 

bargool

  • Guest
Re: 64 bit generic question
« Reply #13 on: April 04, 2013, 02:28:16 AM »
There is a very fast file-search tool Everything http://www.voidtools.com/
They use low level access to NTFS
It can be installed on the server and listen for queries http://www.voidtools.com/faq.php#Can__Everything__index_a_mapped_network_drive
Maybe, you can query that software from your app. http://support.voidtools.com/everything/ETP
I didn't try, just assume

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: 64 bit generic question
« Reply #14 on: April 04, 2013, 10:08:44 AM »
TT - I was thinking the same, but was hoping I did something wrong that could be improved.

Bryco - I heard that, so I just built the Release code targeted at x64 and hoped for the best.

Mohnston - It is a stand alone app outside of Acad.  I use it to search for duplicate file names.

Will - I will look into this, it might work

Bargool - I will have to see what that does as well.

Thanks guys
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: 64 bit generic question
« Reply #15 on: April 04, 2013, 10:29:05 AM »
This is one of the reasons why so many application developers are going crazy with "file indexing" schemes so their own search processes don't become a bottleneck.  You might be able to do similar optimization for folders you know don't change that often.  For example, use a FileSystemWatcher or similar running in the background to cache information for a large number of low-activity folders and run-time scans for a smaller number of more active locations.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}