Take a look at this, the function primpyths1, generates all primitive Pythagorean triangles with a given input value for x. The remainder of the code creates a table up to 10000, also creates a reversed copy and joins them and finally prints them out. On my pc it takes 1.88 seconds to complete.
The function can easily be altered to generate all Pythagorean triangles, just remove the GCD[x,#]==1 section and change the #<=x to #>x. and if you wish add , Sqrt[x^2 + m[[i]]^2] in the table section.
primpyths1[x_Integer] := (t = Select[Divisors[x^2], # <= x &];
m = Sort[
Select[(x^2 - t^2)/(2 t),
IntegerQ[#] && # <= x && GCD[x, #] == 1 &]];
Table[{x, m[[i]]}, {i, 1, Length[m]}])
primp = Flatten[Table[primpyths1[i], {i, 3, 10000}], 1]; prmp1 =
RotateLeft /@ primp[[All, 1 ;; 2]]; allp =
Riffle[primp, prmp1]; ListPlot[allp, AspectRatio -> 1,
GridLines -> {{10000}, {10000}}]