47

I've been working on a VBA macro that parses HTML into a an Excel sheet. The code is functional, but extremely slow (it takes roughly 20 seconds to fill 270 lines from columns B to M). Due to the code being functional, I suspect it would be best submitted to Code Review.

But. The code I have is parsing information from several sites and not just one, with multiple subs handling each one individually due to the different structures.

What I'd like to ask about is if there are any particular formulas or functions that exist and that I could re-use for each sub/site, instead of posting each snippet for them to be reviewed.

Would it be better to post my code on Code Review with the question as a footnote of sorts, or would it be better to post on Stack Overflow since it's more of a programming question and not just asking for help re-writing a functioning bit of code?

2
  • 4
    It may be more appropriate for SO if you can figure out which part of it is the bottleneck. I would try to understand that before posting. Having worked with Excel automation before I know that writing values to cells is incredibly slow but there are various techniques you can use to speed it up.
    – DavidG
    Commented Aug 7, 2015 at 12:52
  • 3
    So you have a macro that scrapes multiple sites and it takes 20 seconds to run. Did you ever consider that the "performance" issue is just the result of iteratively loading each page?
    – Travis J
    Commented Aug 7, 2015 at 17:38

2 Answers 2

41

Working but slow code is on topic on either site.

Be aware, however, that if you post on Code Review, valid answers can address any issues with your code, even to the point of ignoring performance completely.

On the other hand, a question on Stack Overflow focused on the fact that your performance target is missed will lead to answers related only to performance (other issues may be raised in comments).

3
  • 13
    Though with SO, your question would have to be more spectific. "Here's a bunch of code, why is it slow?" probably wouldn't fly unless you'd already narrowed the performance issue down to a single function or a few lines.
    – Ajedi32
    Commented Aug 10, 2015 at 3:22
  • Is it bad practice to ask a question on both? Should users pick one or the other?
    – AdamMc331
    Commented Oct 2, 2015 at 18:18
  • 5
    @McAdam331: Cross-posting is indeed frowned upon. It duplicates effort by answerers, which are the scarce resource that makes Q&A work in the first place. Much better to ask only once, on the site that better lines up with what you are hoping to learn about your code.
    – Ben Voigt
    Commented Oct 2, 2015 at 18:22
24

I believe Code Review is suited for your question, they do have a performance tag, among others that have similar context, e.g. memory-optimization.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .